YouTube Playlist – ActionScript 2 YouTube API
I did some projects for some of my clients where I had to use the YouTube API to load videos in flash from the YouTube website. I remember I spent a lot of time trying to find a working example that I could use on my project. I first tried to work with the ActionScript 3 chromeless YouTube API (a friend of mine did a fast example using Flex and this API) but just when I thought the project is done, I got a message back from the client saying that he can not use the player because it’s working through some JavaScript code and his users can’t embed the player on myspace, facebook and stuff like that. Then I had to start form scratch but this time I had to make it work with ActionScript 2 (at the time there was very little documentation about this on code.google.com)… after some hours of research and experiments I finally made the YouTube player in ActionScript 2 and I delivered the project without problems. Now I want to share with all of you the code that I used to get a project like this done. I have uploaded a zip archive with all the files you need if you want to get started with a similar project.
Click here if you want to see how this YouTube Playlist app looks like ![]()
YouTube Playlist (22.3 KiB, 890 hits)
Here you can see some of the projects I did using this API:
meeetv.com project
actionext.com project, I did 4 players for this client with 4 different skins and very similar code on all 4 of them.
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

I didn’t know you could make your own player for YouTube. Thanks for sharing.
great player. I would like to make it with the original chrome. I’m making a player for a client that will have:
1) scrolling thumbnails of the videos (I can get this done)
2) and hopefully the ability to get metatag data, ability to sort content by latest videos, most popular, highest rated.
If you have any suggestions for 2) please let me know and thanks for the great examples.
ray…
Here you can read the YouTube API documentation and see if you can find any info that will help you with your project:
http://code.google.com/apis/youtube/flash_api_reference.html
Hi Vamapaull. Your player is nice, is there anyway to make the video larger? Thanks..
@aaron
Yes, sure… there is a way
i love your cryptic answer, and i was very confident that i could figure out how to make the video larger, but i’m stumped! can you give me a hand with how to make the video come out larger?
Main timeline ActionScript 2 code:
line 15
ytplayer.setSize(370, 240);
370 is the width number
240 is the height number
I just found out it’s necessary to insert a second “ytplayer.setSize(370, 240);” line inside the onEnterFrame in order to make Flash resize video. I was trying to leave it in HQ size (960×505) but I couldn’t. So, instead of making it set size with onLoad, I inserted it inside the onEnterFrame. It worked perfectly!
Dunno if this problem was only with me, but who’s with this problem, should try it!
BTW, thanks vamapaull for sharing it with us! It really came in handy!
Somehow the player isn’t playing the YouTube videos anymore. I’ve checked your demonstration page and the same error happens. I’ve tested on Firefox and Safari. With Safari, I’ve checked the error in Window > Activity, and it displays something like “require payment”. What does it mean?
@dsaportfolio – it’s working fine here… make sure you have valid youtube video ID’s in the playlist.
hello friend, I would like to not have player playlist, showing a single video much will it cost I like your example but I do not understand