ken_adams
asked on
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.m ov" 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(do cument.mov ie1);">cli ck to play the movie</a>
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:document. embeds['mo vie1'].Pla y();">clic k to play in IE?</a>
</center>
</BODY>
</HTML>
Thanks,
-ken
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.m
<br><br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:PlayIt(do
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:document.
</center>
</BODY>
</HTML>
Thanks,
-ken
ASKER
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
http://davidrathod.com/rnd/single_movie.htm
thanks,
-ken
Well if you use this you'll see that you can "get to" the object:
<a href="javascript:alert(doc ument.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
<a href="javascript:alert(doc
because it returns "[object]".
Just can't seem to get it to play!
I'll see what I can find....
:oP
Ant
Sorry, I'm being "thick"... document.embeds gets you to the object aswell!
Ant
Ant
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.m ov" 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(do cument.mov ie1);">cli ck to play the movie</a>
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript: void(0); " onclick="alert(document.em beds['movi e1'].behav iorUrns);" >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.m ov" 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(do cument.mov ie1);">cli ck to play the movie</a>
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:alert(doc ument.embe ds['movie1 ']);">clic k 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
<!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.m
<br><br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:PlayIt(do
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript: void(0); " onclick="alert(document.em
</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.m
<br><br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:PlayIt(do
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:alert(doc
</center>
<SCRIPT LANGUAGE="JavaScript">
<!--
var output = '';
for (var i in document.embeds[0])
output += i+ '<br>';
document.write(output);
//-->
</SCRIPT>
</BODY>
</HTML>
Ant
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
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
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.m ov" 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(do cument.mov ie1);">cli ck to play the movie</a>
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript: void(0); " onclick="alert(document.em beds['movi e1'].behav iorUrns);" >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
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.m
pluginspage="http://www.apple.com/quicktime/download/" bgcolor="black"></embed>
<br><br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript:PlayIt(do
<br>
<!-- THIS LINK WORKS IN NETSCAPE ONLY -->
<a href="javascript: void(0); " onclick="alert(document.em
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
ASKER
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
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
ASKER
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
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
ASKER
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....
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....
This seems like one of those rare cases where Netscape has better support for something than IE!!
Ant
Ant
ASKER
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
-ken
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.app Version)
ie4=(ver>3 && navigator.appName!="Netsca pe")?1:0
ns4=(ver>3 && navigator.appName=="Netsca pe")?1:0
ns3=(ver==3 && navigator.appName=="Netsca pe")?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.sound File.IsRea dy() )
{
soundStr = soundStr.substring(0 , soundStr.indexOf('.'));
self.document.myform.sound File.play( )
}
}
function stopSound() {
if (ie4) self.document.all['BGSOUND _ID'].src= '';
if ((ns4||ns3) && navigator.javaEnabled() && navigator.mimeTypes['audio /x-midi'] )
{
self.document.myform.sound File.stop( )
}
}
var clickCount;
clickCount = 0;
function engageSound(val, t) {
clickCount++;
if ((clickCount%2)==1) {
playSound('sounds/Sound.wa v');
t.checked=true;
}
else {
stopSound();
t.checked=false;
}
}
//-->
</script>
<form name=myform>
<a href="javascript:engageSou nd('sounds \sound.wav ', this);"><input type=radio name="sOn" onclick="engageSound('soun ds\sound.w av', this); return true;">Play</a>
</form>
</body>
</html>
I'd be interested to see if anyone does solve this.
nzjonboy
<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.app
ie4=(ver>3 && navigator.appName!="Netsca
ns4=(ver>3 && navigator.appName=="Netsca
ns3=(ver==3 && navigator.appName=="Netsca
function playSound(s) {
soundStr = s;
if (ie4) self.document.all['BGSOUND
if ((ns4||ns3) && navigator.javaEnabled() && navigator.mimeTypes['audio
{
soundStr = soundStr.substring(0 , soundStr.indexOf('.'));
self.document.myform.sound
}
}
function stopSound() {
if (ie4) self.document.all['BGSOUND
if ((ns4||ns3) && navigator.javaEnabled() && navigator.mimeTypes['audio
{
self.document.myform.sound
}
}
var clickCount;
clickCount = 0;
function engageSound(val, t) {
clickCount++;
if ((clickCount%2)==1) {
playSound('sounds/Sound.wa
t.checked=true;
}
else {
stopSound();
t.checked=false;
}
}
//-->
</script>
<form name=myform>
<a href="javascript:engageSou
</form>
</body>
</html>
I'd be interested to see if anyone does solve this.
nzjonboy
Glad to have helped Ken - sorry it wasn't a more positive result. :o(
Ant
Ant
Maybe Internet Explorer 6 will have better support.... I might see if I can find out.
:o)
Ant
:o)
Ant
ASKER
thanks folks. it would be good to know.
-ken
-ken
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for trying to run this down.
-ken
-ken
My pleasure - sorry things weren't more positive for you.
Ant
Ant
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