views:

265

answers:

2

When a Quicktime movie has ended, I want to replace it with a image slideshow. My current approach is to have the .mov file communicate back to the Javascript on the page. Once the end of the movie is reached, an event calls a function.

So my question is: What method can I use to call a Javascript function when a Quicktime movie ends?

I see some ideas here, but it is difficult to put the pieces together. http://developer.apple.com/mac/library/DOCUMENTATION/QuickTime/Conceptual/QTScripting_JavaScript/bQTScripting_JavaScri_Document/QuickTimeandJavaScri.html#//apple_ref/doc/uid/TP40001526-CH001-SW5

I am hoping to use the qt_ended() function.

Here is my code so far:

 <object width="853" height="496" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"&gt;  
   <param name="enablejavascript" value="true" />
   <param name="postdomevents" value="true" />  
   <param name="src" value="/wp-content/themes/gono9/videos/General_Orders_No9_Trailer1.mov" />  
   <param name="controller" value="true" />  
   <param name="autoplay" value="true" />  
   <param name="scale" value="aspect" />  
   <param name="bgcolor" value="000000" />  
   <param name="cache" value="true" />  
   <embed width="853" height="496" src="/wp-content/themes/gono9/videos/General_Orders_No9_Trailer1.mov" bgcolor="000000" cache="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/" controller="true" enablejavascript="true" postdomevents="true" autoplay="true" scale="aspect"></embed>  
</object>

Does qt_ended() go in my .js file?

I need help putting the pieces together.

If looking at the existing website helps: http://generalordersno9.com
This is related to the trailer.

A: 

qt_ended isnt necessaily the function name. thats the event name it fires. You have to add the function as a callback to the event. Ive never messed with QT via js but using jquery it would look something like this:

var myQuickTime = {
  ended : function() {
    // save a reference to the movie object
    var movie = this;

    // do stuff when the movie has ended
    alert('Movie "#'+$(movie).attr('id')+'" Done!');
  }
};

$(function(){
  // add the listener on dom ready
  $('#mymovie').bind('qt_ended', myQickTime.ended);
});

Now im not 100% on using jQuery's bind method. It may be for some reason that you have to use baseline js as shown in the examples on the link you posted (see the myAddListener function). I wouldnt think this is the case because this is part of what jQuery's bind method does, but you never know :-)

prodigitalson
Yah, I am not getting this to work.
Christopher Altman
+1  A: 

I answered my own question by reading the Apple documentation.

For those interested the code is here:
http://www.generalordersno9.com/wp-content/themes/gono9/js/g.js

And the demo is here: http://www.generalordersno9.com/

Christopher Altman
Thank you prodigitalson for the help.
Christopher Altman