472,096 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 software developers and data experts.

Problem getting the length of a rtsp streamed movie clip

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()",(movieE nd-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');
}

Oct 15 '05 #1
1 3155

torbs wrote:
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.


If I understand you correctly, your script works correctly for a movie
stored on the same ordinary html server on which the script works.
Streaming the movie in this way is sometimes called progressive
download. The movie is actually downloaded to the viewing browser, but
starts playing after a brief buffering time to allow the download to
get ahead of the playing of the movie. The download is kept in the
temporary cache of the viewing computer and allows the movie to be
played back again without re-downloading the next time you click on the
URL for the movie, unless the temporary cache is erased.

It sounds as if the rtsp stream you mention is the movie on a special
streaming server remote from the server on which you have your script.
A streaming server has the advantage that it keeps a more steady
download stream than a regular html server and limits the number of
viewers at any one time to keep the download steady. It is also
necessary for a stream without breaks, such as live radio or video.
Thus the video can be played back without downloading the whole movie
in a temporary cache as it plays. For example, for a real meida .rm
video file on a streaming server, you link to it through a redirector
..ram file which just directs to the streaming server using an address
starting with rtsp rather than html. Of course the real player can be
used to play other video formats than the Real .rm ones.

I am guessing that when you link to a streaming server, through a
redirector file, you can not access the properties of the movie. In
fact, with a video file on a streaming server, you can not usually even
download the movie to your computer. There likely is some additional
information about this on the vast Real developer site. Finding the
information in that maze could take quite a bit of time.

Oct 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by JesusFreak | last post: by
29 posts views Thread by Chris Riesbeck | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.