Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 95538

Re: YouTube autoplay in flash

$
0
0

Security.allowDomain("www.youtube.com");

Security.allowDomain("http://s.ytimg.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 {

     addChild(loader);

     loader.content.addEventListener ("onReady", onPlayerReady);

}

 

function onPlayerReady(event:Event):void {

     videoPlayer = loader.content;

     videoPlayer.setSize(150, 150); //PUT THE DIMENSIONS OF YOUR VIDEO IN THIS LINE

     videoPlayer.cueVideoByUrl("www.youtube.com/embed/G0gEfsuXRmU", 0);//PUT YOUR VIDEO URL IN THIS LINE

     videoPlayer.playVideo();

}


Viewing all articles
Browse latest Browse all 95538

Trending Articles