Youtube chromeless player flash source

Following on from my recent post ‘Youtube chromeless player example‘ I’ve finally found the time to get this example source put up available for download.

Click to view Youtube chromelss player AS3 example

So here’s the brief.
The raw code for the Youtube API can be found here. The API is available in both AS2 and AS3. This is a basics you need to get started creating your own chromeless player example in AS3. You can download an sample AS2 version fla from here. You can of course skip this and go ahead and download my moded AS3 version of the chromeless player and hack it to fit your own needs. In my example I’ve set it up so that you can set set the video id in flash embed params and on url like here: www.scotflash.co.uk/youtube/?id=8hn15ugMJ4k. If no id is found then flash will load a default video id already set inside the swf.

The source is fully commented and includes both the fla file and html embed page to get you on your way.

This entry was posted in Flash AS3, Flash CS3 components and tagged , , , , , , . Bookmark the permalink.

15 Responses to Youtube chromeless player flash source

  1. VC:One says:

    FIRST!!!!!!!!!!!!

    Cool!! Thanks for this… Will look at at it properly later today. I too have a netstream player but just wasn’t sure how to move it up to handling Youtube clips. I will study your source code and get some hints. Peace out.

    PS: Was about to say what? no comments on this?… then I saw the posting date, lol.

  2. phbu.com says:

    hey…i’m trying to create the same thing here but found a problem with your player (i have the same problem). If user wants to seek to a position that hasn’t been buffered yet it won’t work…
    you need to somehow implement player.getVideoStartBytes():Number

  3. Paul Ferrie says:

    Yeah i saw that issue myself. I disabled the seekAhead for now. I do plan to come back to this and update.

  4. LL says:

    Very nice, good work. Do you an “AS2 version of your soure” that can be downloaded, I only see the AS3 version?

  5. LL says:

    Yeah thanks I was already familiar with that link and saw that you already referenced it in your post above. Yours is better though, so I wanted to see if you had an AS2 version. No biggie I guess. :-)

  6. zdravko says:

    Folks,

    player.seekTo() function takes 2 parameters – first is of course the number of seconds to where you want to advance into the video – the second is a logical and it deals with allowing advancing. When I set it to true it allows jumping. However, you should read YT player API docs because there is some mumbo jumbo suggesting that it should always be false.

    HTH,
    zdravko

  7. zdravko says:

    I got the full screen mode to work (on/off). I lucked into finding an article that states that it can be invoked only with mouse clicks or keyboard events, so it has to be a click=”function(event)” in flex 4 and the function has to be function (event:MouseEvent).

    My problem is that the full mode works perfectly during the first video and as soon as I advance to the next one, I can hear the sound but the video goes totally blank. What appears is the background color of the container that contains the player. However, tracing all of the sizes and alpha and visibility indicate that it’s still there – intact.

    What gives?

  8. nite says:

    hi scott
    do u know how to make inbuilt fullscreen button work in youtube as3 player without using chromeless player

    thanks :)

  9. Paul says:

    What are you using if not the chromless player?

  10. Graham says:

    I know it’s been a while since you update this, but I was wondering if it was possible to have 2 separate instances of the chromeless player in one flash file playing 2 different videos.

    When I tried duplicating the actionscript on a different frame/scene and amending it to pull in a new videos it loaded up the original video.

    Thanks in advance.

    Graham

  11. All you need to do is create a duplicate of the player holder mc found in the library.

  12. Graham says:

    Thanks Paul, do I need to edit/duplicate the actionscript to reflect this?
    I’m quite new to AS3 so sorry in advance if that’s a no-brainer of a question.

  13. Hi Graham. Once you have your 2 copies of the ‘player holder’ all that is left to do is to go into each and set your own video ID for each. The video ID can be found on line: 22 – videoArray = new Array(“youtube_video_id_here”)

  14. Graham says:

    Awww man *facepalm* seems so simple now. What an idiot.

    Thanks again for all your help.