Reputation: 20049
I am wondering what my best option is to delay the loading/playing of a movie that is set to autoplay?
The videos are all external if that matters; is there any kind of code I can fire within a javascript function once I want it to start? That would be ideal.
Upvotes: 0
Views: 1689
Reputation: 4581
Controlling the playback of an embedded SWF and a video loaded within the SWF are completely different tasks. If you'd like to delay the start of your video AFTER the SWF has been embedded, you'll need to set up some sort of delay method in your actionscript. If you'd like to control the video via JavaScript, you'll need to use ExternalInterface. There are some EI examples at http://learnswfobject.com/advanced-topics/external-interface/
Upvotes: 0
Reputation: 178094
var movie = '<object....><embed....</embed></object>';
window.onload=function() {
var tId = setTimeout(function() {document.getElementById('movieContainer').innerHMTL=movie;},3000); // delay 3 secs
}
.
.
.
<div id="movieContainer"><img src="trailer.jpg" /></div>
Upvotes: 2