Auto YouTube "Best Version" Selection with AS3 & Flex

hd

Here's one from my library, made it a few months ago to auto get the best version of a video from youtube.

Not too much to write on this one, you pass in the url of a youtube video (the normal web url) - it'll first try and load the HD version, then the HQ version and finally falls back to the "normal" quality version; the class extends mx.controls.VideoDisplay so you have all the normal methods.

Further, it only does all the detection stuff if the url is a youtube video, if it isn't then it loads the video as per usual, so it can be used as a replacement class for VideoDisplay without any negative effects or strange functionality.

no demo, just the source. Uses Flex 3 and ActionScript 3

hope it's of use to somebody!

Source: CleverVideo.as

Usage:

video : CleverVideo = new CleverVideo( 'http://www.youtube.com/watch?v=_OBlgSz8sSM' );
addChild( video );
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Printed from: http://webr3.org/blog/video/auto-youtube-best-version-selection-with-as3-flex/ .
© Your Name Here 2010.

Leave a Reply

Additional comments powered by BackType

  • webr3 avatar