Skip to content

Instantly share code, notes, and snippets.

@lucasmlessa
Created June 30, 2015 22:14
Show Gist options
  • Select an option

  • Save lucasmlessa/755c7228c0cc379869b8 to your computer and use it in GitHub Desktop.

Select an option

Save lucasmlessa/755c7228c0cc379869b8 to your computer and use it in GitHub Desktop.
Player do Youtube em ActionScript 3
Security.allowDomain("www.youtube.com");
var videoPlayer:Object;
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
function onLoaderInit(event:Event):void {
youTuba.addChild(loader); // MovieClip (Objeto) onde será carregado o vídeo
loader.content.addEventListener("onReady", onPlayerReady);
}
function onPlayerReady(event:Event):void {
trace("Ready");
videoPlayer = loader.content;
videoPlayer.setSize(220, 120); // Tamanho do vídeo
videoPlayer.cueVideoByUrl("http://www.youtube.com/v/OUdoEoy2dbo", 0);// Endereço do vídeo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment