RSS feed
<< January 18, 2008 | Home | January 20, 2008 >>

Separating flash player from content

When you load a YouTube video there are two components that actually get loaded, the object that plays the video and the video itself. If you know the location of the video you can replace the player with one of your own. The video below combines a YouTube video with Jeroen Wijering's FLV player.

If you look at the source for the embedded object you'll notice that the player is pulled from www.jeroenwijering.com and the video is being pulled from some youtube.com machine.

<embed
src="http://www.jeroenwijering.com/extras/mediaplayer.swf"
width="424"
height="350"
allowfullscreen="true"
flashvars="file=http://ash-v51.ash.youtube.com/get_video?video_id=xj8ZadKgdC0"/>

To get the URL of the video, I fired up a packet sniffer (Ethereal), clicked on the player, and made note of any packets going to and from my machine. The traffic looked something like this. First it tried to figure out who www.youtube.com was, then it asked the web server for a resource. It then tried to figure out who youtube-925.vo.llnwd.net was and made a request of it, this time the request contained the URL of the video, make apparent by the flv extension.

Standard query A DNS www.youtube.com
GET /get_video?video_id=jWPY7b35vF4&t=OEgsToPDskIuwBgwhnC7XCouUAwCOKaB&eurl=http%3A%2F%2Fwww%2Eqicboy%2Ecom%2F
Standard query A youtube-925.vo.llnwd.net
GET /d1/01/4D/jWPY7b35vF4.flv

This might not be useful for YouTube necessarily but it suggests an alternative for accessing flv files available on the web, possibly as a way of circumventing the configuration (cross domain option) of the flash player usually bundled with that flv file. Alternatively, it can provide a simple solution to embedding FLV files whose player doesn't have an obvious way of copying the embed/object code. Simply determine the fill path to the FLV file you want to embed and use it to replace the path to the FLV file in the example.

<< January 18, 2008 | Home | January 20, 2008 >>