Category Archives: programming

Quicktime Javascript Examples

I had a request to post some examples of Javascript controls for Quicktime movies. Here are the code samples.

This is the Javascript that controls to use:

<script language="JavaScript">
<!--
/* a javascript function that takes a QT movie and calls its "Play" method */
function PlayIt(anObj)
{
anObj.Play();
}
/* a javascript function that takes a QT movie and calls its "Stop" method */
function StopIt(anObj)
{
anObj.Stop();
}
/* a javascript function that takes a QT movie and calls its "Rewind" method */
function StartIt(anObj)
{
anObj.Rewind();
}
/* a javascript function that takes a QT movie and calls its "Reverse" method */
function ReverseIt(anObj)
{
anObj.Step(-1);
}
/* a javascript function that takes a QT movie and calls its "Reverse" method */
function ForwardIt(anObj)
{
anObj.Step(1);
}
//-->

</script>

This is the QuickTime embedding sample:

<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
 codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="movie1" height="240" width="320"> 
<param name="src" value="../movies/ax.mov">
<param name="AUTOPLAY" value="false">
<param name="CONTROLLER" value="false">
<embed src="../movies/ax.mov" name="movie1" enablejavascript="true" controller="false" autoplay="false" height="240" width="320">
</object>

This is a sample form containing all play buttons:

<form name="theform">
<input name="reverse" value="Rwd" onclick="javascript:ReverseIt(document.movie1);" type="button">
<input name="play" value="Play" onclick="document.movie1.Play();" type="button">
<input name="stop" value="Stop" onclick="document.movie1.Stop();" type="button">
<input name="forward" value="Fwd" onclick="javascript:ForwardIt(document.movie1);" type="button">
<input name="begin" value="Start Over" onclick="javascript:StartIt(document.movie1);" type="button">
</form>

Quicktime JavaScript Controls

I have been trying to use JavaScript to control QuickTime within the new Safari browser from Apple. The only browser running on OSX that the controls worked for was Netscape. A summary from Apple’s Web site shows this to be true:

  • QuickTime 4.1 is scriptable using Netscape 4 or 5 on Windows and
    Macintosh

  • QuickTime 6 is scriptable using Internet Explorer on Windows, and
    most or all Netscape or Mozilla-based browsers on Windows or Macintosh.

  • Plug-ins are not scriptable using Internet Explorer for Macintosh