XF 2.0 Parse a media URL and get it's embed code?

Jaxel

Well-known member
Is there a simple function I can use to parse a media URL and get it's embed code?

For instance, I have the following string https://www.youtube.com/watch?v=5_woD7TJziw; I need to get back it's embed code using the XF2 media site system.
 
You can find all the components you need by inspecting /src/XF/BbCode/ProcessorAction/AutoLink.php - specifically, getEmbedBbCode

Once you've implemented that function in one way or another, you'll be given the MEDIA BBCode which your template can parse :)


Fillip
 
Top Bottom