Youtube Video Player In Flash

Hi Everyone.

I’m working on a nice and easy YouTube video player for Flash. It’s working well – and it’s essentially a component you just drag into your library, instantiate it with some AS3, point it to a specific video ID, and then tell it to play.. And it plays – within your Flash movie. Click “More” to see it in action.. I built it as a very simple Pause/Play player, with a single video hardcoded in my AS3 initialization, but there are lots of other features and abilities in store.. I’ve deliberately put a blur effect on mouse movement just to prove that it is indeed playing the YouTube video, from youtube, within Flash, totally operable with AS3. I also set it up with a hideous blue background for the same reason.

This is by far the easiest way to get YouTube videos within Flash directly. A few lines of code:

var player:MovieClip = new YouTubePlayer();
player.x = 2;
player.y = 2;
player.movieId = "kaot6D6Q7WY";
player.vautoPlay = true;
addChild(player);

And you’re off and running!

Click “Continue Reading” to see it in action within the page.

[swfobj src=”/SimpleYTPlayer.swf” width=”488″ height=”398″]

Hmm… something seems to be wrong with loading the swf

[/swfobj]

Facebook Comments

Leave a Reply