;

PDA

Click to See Complete Forum and Search --> : Autoplay embedded youtube video


ebswift
09-26-2007, 11:33 PM
I am embedding a youtube video in a scene, but when I load the youtube video it shows the big play button in the middle of the video instead of just playing. Can anyone please tell me the line of code to kick the thing into action automatically?


on (press) {
stopAllSounds();

System.security.allowDomain("http://www.youtube.com");
System.security.loadPolicyFile("http://www.youtube.com/crossdomain.xml");

var ldsceneholder = new MovieClipLoader();
ldsceneholder.loadClip("http://www.youtube.com/v/IMGYpOxvHDk.swf", mc100);
ldsceneholder.onLoadInit = function(mc) {
mc100._width = 50;
mc100._height = 50;
}
}

blanius
09-28-2007, 01:52 AM
I think you can add &autoplay=true to the URL

See this page
http://www.jakeludington.com/ask_jake/20061002_automatically_start_youtube_video_playbac k.html

blanius
09-28-2007, 01:53 AM
http://www.htmlcodetutorial.com/help/ptopic7204.html

ebswift
09-28-2007, 02:18 AM
That didn't seem to work. It probably doesn't matter anyway, I have found that the koolmoves mediaplayer solves any issues there, providing you can resolve the flv address from youtube. I couldn't figure that out but ended up resorting to using a google cache address for the youtube video. A google search will give a correct way to resolve the flv location.

blanius
09-28-2007, 05:54 PM
It didn't work with you're URL but When I pasted your YouTube URL into my browser, YouTube does some sort of redirect and if you take that URL and add the autoplay variable it does work.

You're URL resolves as
http://www.youtube.com/jp.swf?video_id=IMGYpOxvHDk&eurl=&iurl=http%3A//img.youtube.com/vi/IMGYpOxvHDk/default.jpg&t=OEgsToPDskKL9hhIuRb0ONt-BN-_kHw-

Then I added &autoplay=true and viola
http://www.youtube.com/jp.swf?video_id=IMGYpOxvHDk&eurl=&iurl=http%3A//img.youtube.com/vi/IMGYpOxvHDk/default.jpg&t=OEgsToPDskKL9hhIuRb0ONt-BN-_kHw-&autoplay=true