T
torbs
I have a problem when I use javascript to get the length and position
of a movie I recieve from a rtsp stream. The length and position is
extremely high and not the actual length and position of the movie.
When I try Real Player and it's methods I recieve a length and position
of 0.
Can anyone see what I am doing wrong?
I have two players that I give the same absolute position. I hide one
and play the other. When the player have almost reached the end of the
clip, I start the clip in the other player, and hide the first player.
That is the idea, and it works on local movie files on my computer.
code :
function changeVisibility(id,action) {
switch (action) {
case "show":
if (layerobject)
document.layers[''+id+''].visibility = "show";
else if (allobject)
document.all[''+id+''].style.visibility = "visible";
else if (dom)
document.getElementById(''+id+'').style.visibility = "visible";
break;
case "hide":
if (layerobject)
document.layers[''+id+''].visibility = "hide";
else if (allobject)
document.all[''+id+''].style.visibility = "hidden";
else if (dom)
document.getElementById(''+id+'').style.visibility = "hidden";
break;
default:return;
}
return;
}
/* define function that calls QuickTime's "Play" method */
function PlayIt(anObj)
{
anObj.Play();
}
/* define function that calls QuickTime's "Stop" method */
function StopIt(anObj)
{
anObj.Stop();
}
function changeIfEnd(anObj) {
var movieEnd=document.movie1.GetEndTime();
var movieNow=document.movie1.GetTime();
//Start up the other player 500 milliseconds before the end of the
//first movie
timeUntilSwitch=setTimeout("switchMovie()",(movieEnd-movieNow-500));
}
function switchMovie() {
PlayIt(document.movie1);
for (var i = 1; i <= 100000; i++) {} //A small delay for startup.
changeVisibility('movie1','show');
changeVisibility('movie2','hide');
}
of a movie I recieve from a rtsp stream. The length and position is
extremely high and not the actual length and position of the movie.
When I try Real Player and it's methods I recieve a length and position
of 0.
Can anyone see what I am doing wrong?
I have two players that I give the same absolute position. I hide one
and play the other. When the player have almost reached the end of the
clip, I start the clip in the other player, and hide the first player.
That is the idea, and it works on local movie files on my computer.
code :
function changeVisibility(id,action) {
switch (action) {
case "show":
if (layerobject)
document.layers[''+id+''].visibility = "show";
else if (allobject)
document.all[''+id+''].style.visibility = "visible";
else if (dom)
document.getElementById(''+id+'').style.visibility = "visible";
break;
case "hide":
if (layerobject)
document.layers[''+id+''].visibility = "hide";
else if (allobject)
document.all[''+id+''].style.visibility = "hidden";
else if (dom)
document.getElementById(''+id+'').style.visibility = "hidden";
break;
default:return;
}
return;
}
/* define function that calls QuickTime's "Play" method */
function PlayIt(anObj)
{
anObj.Play();
}
/* define function that calls QuickTime's "Stop" method */
function StopIt(anObj)
{
anObj.Stop();
}
function changeIfEnd(anObj) {
var movieEnd=document.movie1.GetEndTime();
var movieNow=document.movie1.GetTime();
//Start up the other player 500 milliseconds before the end of the
//first movie
timeUntilSwitch=setTimeout("switchMovie()",(movieEnd-movieNow-500));
}
function switchMovie() {
PlayIt(document.movie1);
for (var i = 1; i <= 100000; i++) {} //A small delay for startup.
changeVisibility('movie1','show');
changeVisibility('movie2','hide');
}