• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

IE javaScript or vbscript solution to QuickTime playback

I need to start playback of a QuickTime 4 movie from IE4.x and up using an external link to a function or in-line code.  I'm putting up 200 points in hopes of a swift cross browser solution.

I've got it working in Netscape 4.7 at the following url: http://davidrathod.com/rnd/

code is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
               "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>

<SCRIPT LANGUAGE="Javascript">
<!--

        /* takes a QT movie and calls its "Play" method */
        function PlayIt(anObj)
        {
                anObj.Play();
        }



//-->
</SCRIPT>
<HEAD>
     <TITLE>test QT play</TITLE>
</HEAD>
<BODY>
<center>
<embed src="../qt/0804sun_tango.mov" name="movie1" width="320" height="256" autoplay="false" enablejavascript="true" pluginspage="http://www.apple.com/quicktime/download/" bgcolor="black"></embed>

<br><br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:PlayIt(document.movie1);">click to play the movie</a>
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:document.embeds['movie1'].Play();">click to play in IE?</a>

</center>


</BODY>
</HTML>

Thanks,

-ken

0
ken_adams
Asked:
ken_adams
  • 11
  • 7
1 Solution
 
a.marshCommented:
First of all vbscript is no good as it is only any good in IE.

Could you give us a link to the page above so that we can actually load the movie in order to work with this for you?

:o)

Ant
0
 
ken_adamsAuthor Commented:
the url is at the top of the question but i modified the directory.  here is is:  
http://davidrathod.com/rnd/single_movie.htm

thanks,

-ken
0
 
a.marshCommented:
Well if you use this you'll see that you can "get to" the object:

<a href="javascript:alert(document.all.movie1);">click to play in IE?</a>

because it returns "[object]".

Just can't seem to get it to play!

I'll see what I can find....

:oP

Ant
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
a.marshCommented:
Sorry, I'm being "thick"... document.embeds gets you to the object aswell!

Ant
0
 
a.marshCommented:
By adding this piece of clever javascript you can get a list of all attributes and methods of the embed object:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
               "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>

<SCRIPT LANGUAGE="Javascript">
<!--

        /* takes a QT movie and calls its "Play" method */
        function PlayIt(anObj)
        {
                anObj.Play();
        }



//-->
</SCRIPT>
<HEAD>
<base href="http://davidrathod.com/rnd/">
     <TITLE>test QT play</TITLE>
</HEAD>
<BODY>
<center>
<embed src="../qt/0804sun_tango.mov" name="movie1" width="320" height="256" autoplay="false" enablejavascript="true" pluginspage="http://www.apple.com/quicktime/download/" bgcolor="black"></embed>

<br><br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:PlayIt(document.movie1);">click to play the movie</a>
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript: void(0); " onclick="alert(document.embeds['movie1'].behaviorUrns);">click to play in IE?</a>

</center>

<SCRIPT LANGUAGE="JavaScript">
<!--
    var output = '';
    for (var i in document.embeds[0])
        output += i+ '<br>';
    document.write(output);
//-->
</SCRIPT>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
               "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>

<SCRIPT LANGUAGE="Javascript">
<!--

        /* takes a QT movie and calls its "Play" method */
        function PlayIt(anObj)
        {
                anObj.Play();
        }



//-->
</SCRIPT>
<HEAD>
<base href="http://davidrathod.com/rnd/">
     <TITLE>test QT play</TITLE>
</HEAD>
<BODY>
<center>
<embed src="../qt/0804sun_tango.mov" name="movie1" width="320" height="256" autoplay="false" enablejavascript="true" pluginspage="http://www.apple.com/quicktime/download/" bgcolor="black"></embed>

<br><br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:PlayIt(document.movie1);">click to play the movie</a>
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:alert(document.embeds['movie1']);">click to play in IE?</a>

</center>

<SCRIPT LANGUAGE="JavaScript">
<!--
    var output = '';
    for (var i in document.embeds[0])
        output += i+ '<br>';
    document.write(output);
//-->
</SCRIPT>
</BODY>
</HTML>


Ant
0
 
a.marshCommented:
As you can see there is no kind of play, run or start method in the list that gets generated....and things are getting worse still, I came across this:

http://developer.apple.com/techpubs/quicktime/qtdevdocs/REF/QT41_HTML/QT41WhatsNew-72.html

which is saying that only Netscape and Javascript work with QuickTime at present....I'm using IE5.5 and Quicktime 4.1.1

Did you get your code from here by any chance?

http://developer.apple.com/techpubs/quicktime/qtdevdocs/REF/QT41_HTML/QT41WhatsNew-72.html

Ant
0
 
a.marshCommented:
Whoops, I just noticed that I must have pressed the paste button twice on my earlier comment!

The code is simply:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
              "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>

<SCRIPT LANGUAGE="Javascript">
<!--

       /* takes a QT movie and calls its "Play" method */
       function PlayIt(anObj)
       {
               anObj.Play();
       }



//-->
</SCRIPT>
<HEAD>
<base href="http://davidrathod.com/rnd/">
    <TITLE>test QT play</TITLE>
</HEAD>
<BODY>
<center>
<embed src="../qt/0804sun_tango.mov" name="movie1" width="320" height="256" autoplay="false" enablejavascript="true"
pluginspage="http://www.apple.com/quicktime/download/" bgcolor="black"></embed>

<br><br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:PlayIt(document.movie1);">click to play the movie</a>
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript: void(0); " onclick="alert(document.embeds['movie1'].behaviorUrns);">click to play
in IE?</a>

</center>

<SCRIPT LANGUAGE="JavaScript">
<!--
   var output = '';
   for (var i in document.embeds[0])
       output += i+ '<br>';
   document.write(output);
//-->
</SCRIPT>
</BODY>
</HTML>


:o)

Ant
0
 
ken_adamsAuthor Commented:
i see what you mean.  it's up at:
http://davidrathod.com/rnd/single_movie.htm

however, i don't see how i can set the movie to play from any of those attributes or methods in IE.  

any suggestions?

-ken
0
 
ken_adamsAuthor Commented:
i see what you mean.  it's up at:
http://davidrathod.com/rnd/single_movie.htm

however, i don't see how i can set the movie to play from any of those attributes or methods in IE.  

any suggestions?

-ken
0
 
ken_adamsAuthor Commented:
sorry our comments crossed.  i only used the first half of your code and got the results.

i don't know if i got the code from that particular technote but i did read that it was problematic, but was hoping there was a work around since i can never find the "ultimate definitive" answer to this cross browser stuff.

hmmmm....
0
 
a.marshCommented:
This seems like one of those rare cases where Netscape has better support for something than IE!!

Ant
0
 
ken_adamsAuthor Commented:
seems so.  i'll leave this open for a while in case anyone else has some ideas, then if not, accept the answer.  thanks for putting in the time.  looks like no one else has approached this question so far but you.

-ken
0
 
nzjonboyCommented:
I don't think you that IE understands the play(0 and stop(0 methods. I had the same trouble with sound. the way I solved this was to change the src of the bgsound tag, like so.

<html>
<body>
<BGSOUND id="BGSOUND_ID" LOOP=1 SRC="">
<EMBED NAME="WLS" SRC="sounds/Sound.wav" LOOP=FALSE AUTOSTART=FALSE HIDDEN=TRUE MASTERSOUND>

<script language="JavaScript">
<!--
ver=parseInt(navigator.appVersion)
ie4=(ver>3  && navigator.appName!="Netscape")?1:0
ns4=(ver>3  && navigator.appName=="Netscape")?1:0
ns3=(ver==3 && navigator.appName=="Netscape")?1:0

function playSound(s) {

 soundStr = s;
 
 if (ie4) self.document.all['BGSOUND_ID'].src=soundStr;
 if ((ns4||ns3) && navigator.javaEnabled() && navigator.mimeTypes['audio/x-midi'] && self.document.myform.soundFile.IsReady() )
 {

  soundStr = soundStr.substring(0 , soundStr.indexOf('.'));
  self.document.myform.soundFile.play()
 }
}

function stopSound() {
 if (ie4) self.document.all['BGSOUND_ID'].src='';
 if ((ns4||ns3) && navigator.javaEnabled() && navigator.mimeTypes['audio/x-midi'] )
 {
  self.document.myform.soundFile.stop()
 }
}

var clickCount;

clickCount = 0;

function engageSound(val, t) {
     clickCount++;

     if ((clickCount%2)==1) {
          playSound('sounds/Sound.wav');
          t.checked=true;
     }
     else {
          stopSound();
          t.checked=false;
     }
}

//-->
</script>

<form name=myform>

<a href="javascript:engageSound('sounds\sound.wav', this);"><input type=radio name="sOn" onclick="engageSound('sounds\sound.wav', this); return true;">Play</a>

</form>
</body>
</html>

I'd be interested to see if anyone does solve this.

nzjonboy
0
 
a.marshCommented:
Glad to have helped Ken - sorry it wasn't a more positive result. :o(


Ant
0
 
a.marshCommented:
Maybe Internet Explorer 6 will have better support.... I might see if I can find out.

:o)

Ant
0
 
ken_adamsAuthor Commented:
thanks folks.  it would be good to know.

-ken
0
 
a.marshCommented:
Well apparently it will have FULL support for DOM level 1 and CSS 1 - so if what is needed is part of DOM level 1 then it should support it.

http://www.microsoft.com/windows/ie/preview/domcss/default.asp

Ant
0
 
ken_adamsAuthor Commented:
thanks for trying to run this down.

-ken
0
 
a.marshCommented:
My pleasure - sorry things weren't more positive for you.

Ant
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 11
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now