Forum Moderators: open

Message Too Old, No Replies

problem with dynamically loading quicktime

         

yuppster

7:48 pm on Jan 3, 2005 (gmt 0)

10+ Year Member



I'm using javascript to dynamically load quicktime movies into a div. It works great in Safari, Firefox and IE6win, but IE for mac it acts wierd. It works, but if you click on one movie link while another movie is playing, it'll load the other one on top (instead of switching it), so you can see parts of both movies playing at once flickering back and forth. It sometimes crashes IEmac or doesn't let you refresh the page. Any ideas on how to get it to work? I assume it could be a slip in my javascript - I'm just learning and kind of hack stuff together. I'd also be interested if someone has found a different way to dynamically load quicktime files into a page.

<No URLs, thanks. See TOS [WebmasterWorld.com]>

Thanks,
Matt

[edited by: DrDoc at 2:50 am (utc) on Jan. 4, 2005]

adni18

8:47 pm on Jan 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe you should add in the following line:

document.getElementById('movId').innerHTML="";

I don't know why this would help, but give it a shot.

yuppster

10:27 pm on Jan 3, 2005 (gmt 0)

10+ Year Member



Thanks for the response. I've tried putting that at the beginning of my setMovie function, which should "clear" the div but it doesn't seem to have any effect. Any other ideas?

adni18

10:35 pm on Jan 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you could change the SRC attribute of the embed obj.

yuppster

10:46 pm on Jan 3, 2005 (gmt 0)

10+ Year Member



Do you mean use:
src="' + movieFile + '"

instead of

<param name="src" value="' + movieFile + '">

in the embed tag?

I tried that and it looks to work the same either way.

adni18

1:02 am on Jan 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



a=document.getElementsByTagName("param");
for(var b=0;b<a.length;b++)
{
if(a[b].name.toLowerCase=="src")
{
a[b].value=movieFile;
}
}

yuppster

6:04 am on Jan 4, 2005 (gmt 0)

10+ Year Member



Sorry to be annoying, but I'm not sure how to incorporate that piece of code into my page. Could you help me out?

adni18

12:30 pm on Jan 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please re-post your entire code(your link was deleted).

yuppster

12:59 pm on Jan 4, 2005 (gmt 0)

10+ Year Member




<html>
<head>

<script type="text/javascript">
function setMovie(movieFile){

document.getElementById('movId').innerHTML=
'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"' +
' codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="320" height="260" id="movie1">' +
'<param name="src" value="'+movieFile+'">' +
'<embed width="320" height="260" enablejavascript="true" name="movie1"' +
' src="'+movieFile+'">' +
'</embed></object>'
}
</script>
</head>
<body>

<a href="#" onClick="setMovie('test1.mov');">test1</a>
<a href="#" onclick="setMovie('test2.mov');">test2</a>
<a href="#" onclick="setMovie('test3.mov');">test3</a>
<a href="#" onclick="setMovie('test4.mov');">test4</a>

<div id="movId">quicktimes load here</div>

</body>
</html>

adni18

1:47 pm on Jan 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<html>
<head>
<script type="text/javascript">
<!--
times=0;
function setMovie(movieFile){
if(times==0)
{
document.getElementById('movId').innerHTML=
'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"' +
' codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="320" height="260" id="movie1">' +
'<param name="src" value="'+movieFile+'">' +
'<embed width="320" height="260" enablejavascript="true" name="movie1"' +
' src="'+movieFile+'">' +
'</embed></object>'
}
else
{
a=document.getElementsByTagName("param");
for(var b=0;b<a.length;b++)
{
if(a[b].name.toLowerCase=="src")
{
a[b].value=movieFile;
}
}
}
times++;
}
//-->
</script>
</head>
<body>

<a href="#" onClick="setMovie('test1.mov');">test1</a>
<a href="#" onclick="setMovie('test2.mov');">test2</a>
<a href="#" onclick="setMovie('test3.mov');">test3</a>
<a href="#" onclick="setMovie('test4.mov');">test4</a>

<div id="movId">quicktimes load here</div>

</body>
</html>