AS3 YouTube Chromeless Player in Flash/Flex
The YouTube Chromeless Player works with AS3/ActionScript 3.

The demo shows great examples of the player with just the window canvas (chromeless) from both javascript and inside of flash.
The project is hosted on Google Code [youtubechromelesswrapper-as3]
Looks like they maybe had a contribution for this, so do it where you can.
This is something we’ve been wanting to provide for a while, and the YouTube API team greatly appreciates the work of developer Matthew Richmond of The Chopping Block for making it happen. Thanks Matthew!
Links
- Demo
- Google Code [youtubechromelesswrapper-as3]
- Article about the library
- Download the source (get from google code recommended)
- Javascript Player Reference
Capabilities/API
Public Methods
player.loadVideoById(id:String, startSeconds:Number = 0):void- Loads and plays video based on specified id.
player.cueNewVideo(id:String, startSeconds:Number = 0):void- Loads but does not automatically play video based on specified id.
player.clearVideo():void- Clears currently cued/loaded video.
player.setSize(w:Number, h:Number):void- Sets the size of YouTubePlayer instance.
player.play():void- Plays the currently cued/loaded video.
player.pause():void- Pauses the currently cued/loaded video.
player.stop():void- Stops the currently cued/loaded video.
player.seekTo(seconds:Number):void- Seeks to specified time within the currently cued/loaded video.
player.getPlayerState():String- Returns the current state of the currently cued/loaded video.
player.getBytesLoaded():Number- Returns the value of current bytes loaded of the currently cued/loaded video.
player.getBytesTotal():Number- Returns the value of total bytes loaded of the currently cued/loaded video.
player.getCurrentTime():Number- Returns the current position in time of the currently cued/loaded video.
player.getDuration():Number- Returns the current duration of the currently cued/loaded video.
player.getStartBytes():Number- Returns the start bytes of the currently cued/loaded video.
player.setVolume(newVolume:Number):void- Sets the volume of the currently cued/loaded video.
player.getVolume():Number- Returns the current volume of the currently cued/loaded video.
player.mute():void- Stores the current volume and changes the volume of the currently cued/loaded video to 0.
player.unmute():void- Returns the volume of the currently cued/loaded video to the last stored value when muted.
player.getEmbedCode():String- Returns the current YouTube embed code of the currently cued/loaded video.
player.getVideoUrl():String- Returns the current YouTube video url of the currently cued/loaded video.
Events
YouTubeLoaderEvent.LOADED- Fired once the Chromeless Player has successfully completed loading and is ready to accept operations calls.
YouTubeLoaderEvent.STATE_CHANGE- Fired whenever the player’s state changes. The YouTubeLoader class translates the JavaScript API numbers to their related string values, the YouTubeLoaderEvent class stores the current event in a variable called
state. Possible values are unstarted, ended, playing, paused, buffering, video cued. When the SWF is first loaded, it will broadcast an unstarted event. When the video is cued and ready to play, it will broadcast a video cued event. YouTubeLoaderEvent.IO_ERROR- Fired when an error in the player occurs. There are two error codes possible: 100 is broadcasted when the video requested is not found. This occurs when a video has been removed (for any reason), or it has been marked as private. 101 is broadcasted when the video requested does not allow playback in the embedded players.
Tags: ACTIONSCRIPT, ACTIONSCRIPT3, API, AS3, canvas, chromeless, flv, player, VIDEO, youtube







