Banago Banago - 3 years ago 146
PHP Question

Programmatically Embed Videos

I'm trying to build a php video embedding function that parses the video URL automatically and then produces the right embed code out of that. I'm having trouble with the new player because there is no reference the the video in the url that makes sense in the embed code. Here goes an example:


Embed Code:

<embed src="" type="application/x-shockwave-flash" width="550" height="327" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" ></embed>

g8hQgs38GwI is the video Id that I cannot guess out of the URL.

Is there a solution to this?

Answer Source

According to Wiki here's what you need to do:

  1. Get the RSS version of the item: (Get id from the URL).
  2. Parse what you got at step 1 (RSS is basically an XML file): Using XPath, the copy/paste code is found at /rss/channel/item/media:player
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download