This document provides reference information for the YouTube Chromeless Player.
The YouTube Chromeless Player gives developers the flexibility to customize the YouTube player with their own controls, player 'chrome', and even behaviors like custom playlists and menus.
The end user must have Flash Player 8 or higher installed. Because of this requirement, we suggest using SWFObject to embed the SWF and detect the user's Flash Player version.
First off, you need a developer key. To register for one, visit the registration page.
The chromeless player consists of two SWF files. apiplayer.SWF contains the actual video playing functionality. cl.SWF is a loader SWF that loads apiplayer.SWF and exposes the player's API functions. It also provides security sandbox restrictions for the apiplayer.SWF, so loading SWFs cannot access elements inside the player directly.
The player can be controlled via two methods — by loading the SWF into another SWF (or Flash website, etc.), or by embedding it directly in an HTML page and using JavaScript to control the player. The JavaScript controls are identical to the embedded player's JavaScript API.
The URL to load the chromeless player SWF is:
http://gdata.youtube.com/apiplayer?key=DEV_KEY
The following operations are available in addition to the ones listed in the JavaScript API documentation.
loadVideoById(videoId:String, startSeconds:Number):VoidstartSeconds (number can be a float) is specified, the video will start from the closest keyframe to the specified time.cueVideoById(videoId:String, startSeconds:Number):VoidplayVideo() or seekTo() is called. startSeconds accepts a float/integer and specifies the time that the video should start playing from when playVideo() is called. If you specify startSeconds and then call seekTo(), the startSeconds is forgotten and the player plays from the time specified in the seekTo() call. When the video is cued and ready to play, the player will broadcast a video cued event (5).setSize(width:Number, height:Number):VoidStage.width and Stage.height values, so there is no need to call setSize() when embedding the chromeless player directly into an HTML page. The default size of the SWF when loaded into another SWF is 320px by 240px.When embedding the chromeless player into an HTML page, enable the JavaScript API by appending a variable to the URL of the SWF:
http://gdata.youtube.com/apiplayer?key=dev_key&enablejsapi=1
For a list of the available API methods and examples of using the JavaScript API, see the reference documentation.
An example of the chromeless player using the JavaScript API can be found here.
For information on loading the chromeless player into another SWF, see the ActionScript 2.0 documentation. All of the API calls are the same, with the addition of the ones outlined above.