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.

Revisions

  1. lucasmlessa created this gist Jun 30, 2015.
    19 changes: 19 additions & 0 deletions gistfile1.as
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    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
    }