Solved

IE javaScript or vbscript solution to QuickTime playback

Posted on 2001-08-05
19
229 Views
Last Modified: 2010-08-05
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
Comment
Question by:ken_adams
  • 11
  • 7
19 Comments
 
LVL 15

Expert Comment

by:a.marsh
ID: 6353844
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
 

Author Comment

by:ken_adams
ID: 6353849
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
 
LVL 15

Expert Comment

by:a.marsh
ID: 6353877
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
 
LVL 15

Expert Comment

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

Ant
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6353974
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
 
LVL 15

Expert Comment

by:a.marsh
ID: 6353996
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
 
LVL 15

Expert Comment

by:a.marsh
ID: 6354000
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
 

Author Comment

by:ken_adams
ID: 6354001
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
 

Author Comment

by:ken_adams
ID: 6354010
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:ken_adams
ID: 6354012
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
 
LVL 15

Expert Comment

by:a.marsh
ID: 6354044
This seems like one of those rare cases where Netscape has better support for something than IE!!

Ant
0
 

Author Comment

by:ken_adams
ID: 6354081
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
 
LVL 3

Expert Comment

by:nzjonboy
ID: 6354119
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
 
LVL 15

Expert Comment

by:a.marsh
ID: 6354132
Glad to have helped Ken - sorry it wasn't a more positive result. :o(


Ant
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6354133
Maybe Internet Explorer 6 will have better support.... I might see if I can find out.

:o)

Ant
0
 

Author Comment

by:ken_adams
ID: 6354143
thanks folks.  it would be good to know.

-ken
0
 
LVL 15

Accepted Solution

by:
a.marsh earned 250 total points
ID: 6354149
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
 

Author Comment

by:ken_adams
ID: 6357771
thanks for trying to run this down.

-ken
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6358441
My pleasure - sorry things weren't more positive for you.

Ant
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now