0
votes

I am trying to make a flash banner in CS4 with AS3. In this banner I have to embed youtube videos.

My problem is.. after the video loaded I cant have/see usual controls (fullscreen, pause, stop, etc) on the video.. and the video has the autoplay by default.

I am using this code:

Security.allowDomain("*");
Security.allowDomain("www.youtube.com");
Security.allowDomain("youtube.com");
Security.allowDomain("s.ytimg.com");
Security.allowDomain("i.ytimg.com");



var my_player1:Object;

var my_loader1:Loader = new Loader();
my_loader1.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
my_loader1.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);

function onLoaderInit(e:Event):void{
addChild(my_loader1);
my_player1 = my_loader1.content;
my_player1.addEventListener("onReady", onPlayerReady);
}

function onPlayerReady(e:Event):void{
my_player1.setSize(200,100);

 /////////////////////////////////    
//this example is with parameter//
//my_player1.loadVideoByUrl("http://www.youtube.com/v/ID-YOUTUBE?autohide=1&autoplay=0&fs=1&rel=0",0);

//////////////////////////////////
// this one is only the video id//
my_player1.loadVideoByUrl("http://www.youtube.com/v/ID-YOUTUBE",0);

} 

I was trying to pass the parameter in the url to try but seems to be is not working. I was checking too the google API for AS3 (http://code.google.com/apis/youtube/flash_api_reference.html) but honestly I dont find the way to implement that I need.

Whats is the way to see this controls in the video??

Thank you :)

1

1 Answers

0
votes

I was trying different thing and I found a partial solution that i want to share with:

Security.allowDomain("www.youtube.com");
Security.allowDomain("youtube.com");
Security.allowDomain("s.ytimg.com");
Security.allowDomain("i.ytimg.com");
Security.allowDomain("s.youtube.com");


var my_player1:Object;

var my_loader1:Loader = new Loader();

//before I used that:
//my_loader1.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));

//Now is use this:
my_loader1.load(new URLRequest("http://www.youtube.com/v/ID_VIDEO?version=3));

my_loader1.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);

function onLoaderInit(e:Event):void{
addChild(my_loader1);
my_player1 = my_loader1.content;
my_player1.addEventListener("onReady", onPlayerReady);
}

function onPlayerReady(e:Event):void{
my_player1.setSize(200,100);

my_player1.loadVideoByUrl("http://www.youtube.com/v/ID_VIDEO",0);


}

Basically Instead of use the "Loading the chromeless player" I use the "Loading the embedded player"

My problem now is How I can modify for example the size of the controls bar.. because is taking 35px height and I want to reduce it

Thank