T
torbs
I am trying to use the methods in quicktimes plugin, but IE generetes
an error. I have tried to use the "document.all" instead of
getElementById but the results remain the same. It won't recognise
"movie1" and "movie2" as objects, and it won't allow me to use their
methods.
And of course IE generates an error message that says nothing about
what might be wrong.
Another problem with this code is that I cannot get the lenght of the
movie because it is streamed with rtsp. Any suggestions?
Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"
/>
<script language=JavaScript" type="text/javascript">
var movieEnd;
var movieNow;
</script>
<style type="text/css">
<!--
#movie1 {
position:absolute;
top:20px;
left:20px;
visibility:hidden;
}
#movie2 {
position:absolute;
top:20px;
left:20px;
visibility:visible;
}
-->
</style>
</head>
<body>
<form1><OBJECT
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
width="320" height="256" id="movie2"
<PARAM name="src" value="L1M1.mov">
<PARAM name="autostart" value="false">
<EMBED HEIGHT=256 WIDTH=320
SRC="L1M1.mov"
TYPE="video/quicktime"
PLUGINSPAGE="www.apple.com/quicktime/download"
NAME="movie2" autostart="false">
<EMBED />
</OBJECT>
<OBJECT
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
width="320" height="256" id="movie1" >
<PARAM name="src" value="L1M1.mov">
<PARAM name="autostart" value="false">
<EMBED HEIGHT=256 WIDTH=320
SRC="L1M1.mov"
TYPE="video/quicktime"
PLUGINSPAGE="www.apple.com/quicktime/download"
NAME="movie1" autostart="false">
<EMBED />
</OBJECT>
</form1>
<script language=JavaScript" type="text/javascript">
<!--
function changeVisibility(id,action) {
var objId = id;
switch (action) {
case "show":
document.form1.getElementById(''+id+'').style.visibility.toLowerCase()
= "visible";}
case "hide":
document.form1.getElementById(''+id+'').style.visibility.toLowerCase()
= "hidden";
default:return;
}
return;
}
function changePosition(id,x,y) {
document.form1.getElementById(ObjId).style.left = x+"px";
document.form1.getElementById(ObjId).style.top = y+"px";
}
/* define function that calls QuickTime's "Play" method */
function PlayIt(id)
{
if (id=="movie1") {
document.form1.movie1.Play();
} else if (id=="movie2") {
document.form1.movie2.Play();
}
}
/* define function that calls QuickTime's "Stop" method */
function StopIt(anObj)
{
if (id=="movie1") {
document.form1.movie1.Stop();
} else if (id=="movie2") {
document.form1.movie2.Stop();
}
}
function changeIfEnd(id) {
if (id=="movie1") {
while (document.form1.movie1.GetPluginStatus() == "Loading") {}
var movieEnd =document.form1.movie2.GetEndTime();
var movieNow =document.form1.movie2.GetTime();
} else if (id=="movie2") {
while (document.fomr1.movie2.GetPluginStatus() == "Loading") {}
var movieEnd =document.form1.movie2.GetEndTime();
var movieNow =document.form1.movie2.GetTime();
}
timeUntilSwitch = setTimeout("switchMovie()",(movieEnd-movieNow);
}
function switchMovie() {
PlayIt('movie1');
for (var i = 1; i <= 10000; i++) {}
changeVisibility('movie1','show');
changeVisibility('movie2','hide');
}
//-->
</script>
<P style="position:absolute;
top:400px;
left:200px;">
</P>
</body>
</html>
an error. I have tried to use the "document.all" instead of
getElementById but the results remain the same. It won't recognise
"movie1" and "movie2" as objects, and it won't allow me to use their
methods.
And of course IE generates an error message that says nothing about
what might be wrong.
Another problem with this code is that I cannot get the lenght of the
movie because it is streamed with rtsp. Any suggestions?
Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"
/>
<script language=JavaScript" type="text/javascript">
var movieEnd;
var movieNow;
</script>
<style type="text/css">
<!--
#movie1 {
position:absolute;
top:20px;
left:20px;
visibility:hidden;
}
#movie2 {
position:absolute;
top:20px;
left:20px;
visibility:visible;
}
-->
</style>
</head>
<body>
<form1><OBJECT
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
width="320" height="256" id="movie2"
<PARAM name="src" value="L1M1.mov">
<PARAM name="autostart" value="false">
<EMBED HEIGHT=256 WIDTH=320
SRC="L1M1.mov"
TYPE="video/quicktime"
PLUGINSPAGE="www.apple.com/quicktime/download"
NAME="movie2" autostart="false">
<EMBED />
</OBJECT>
<OBJECT
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
width="320" height="256" id="movie1" >
<PARAM name="src" value="L1M1.mov">
<PARAM name="autostart" value="false">
<EMBED HEIGHT=256 WIDTH=320
SRC="L1M1.mov"
TYPE="video/quicktime"
PLUGINSPAGE="www.apple.com/quicktime/download"
NAME="movie1" autostart="false">
<EMBED />
</OBJECT>
</form1>
<script language=JavaScript" type="text/javascript">
<!--
function changeVisibility(id,action) {
var objId = id;
switch (action) {
case "show":
document.form1.getElementById(''+id+'').style.visibility.toLowerCase()
= "visible";}
case "hide":
document.form1.getElementById(''+id+'').style.visibility.toLowerCase()
= "hidden";
default:return;
}
return;
}
function changePosition(id,x,y) {
document.form1.getElementById(ObjId).style.left = x+"px";
document.form1.getElementById(ObjId).style.top = y+"px";
}
/* define function that calls QuickTime's "Play" method */
function PlayIt(id)
{
if (id=="movie1") {
document.form1.movie1.Play();
} else if (id=="movie2") {
document.form1.movie2.Play();
}
}
/* define function that calls QuickTime's "Stop" method */
function StopIt(anObj)
{
if (id=="movie1") {
document.form1.movie1.Stop();
} else if (id=="movie2") {
document.form1.movie2.Stop();
}
}
function changeIfEnd(id) {
if (id=="movie1") {
while (document.form1.movie1.GetPluginStatus() == "Loading") {}
var movieEnd =document.form1.movie2.GetEndTime();
var movieNow =document.form1.movie2.GetTime();
} else if (id=="movie2") {
while (document.fomr1.movie2.GetPluginStatus() == "Loading") {}
var movieEnd =document.form1.movie2.GetEndTime();
var movieNow =document.form1.movie2.GetTime();
}
timeUntilSwitch = setTimeout("switchMovie()",(movieEnd-movieNow);
}
function switchMovie() {
PlayIt('movie1');
for (var i = 1; i <= 10000; i++) {}
changeVisibility('movie1','show');
changeVisibility('movie2','hide');
}
//-->
</script>
<P style="position:absolute;
top:400px;
left:200px;">
<a href="javascriptlayIt('movie2');" onclick="changeIfEnd('movie2');"<br>
<a href="javascript:StopIt('movie2');">StopIt</a><br>PlayIt</a><br>
</P>
</body>
</html>