Skip to main content
Participating Frequently
January 10, 2011
Question

Playing recorded files as if they were live

  • January 10, 2011
  • 1 reply
  • 1743 views

Hey everybody,

Let me describe what I am trying to do:

There are some recorded flv files. The guy in the video is showing numbers with his hands. (1.flv, 2.flv, 3.flv etc) And there are live idle videos. In these idle videos the guy doesnt do anything.

I need to be able to click 1 as the operator and viewers should see the guy make "1" in the video. Actually I have accomplished so far. It works. I do this:

If the operator selects a video it adds the video to playlist:   stream.play(filename, -2, -1, false);

Also have this event handler to play a random idle video when there are no more action videos lined up:

function onStreamStatus(obj) {

    if (obj.code != "NetStream.Play.Stop") return;

    switch (obj.code) {

        case "NetStream.Play.Stop":

            playRandomIdleVideo(this.name);

            break;

    }

}

So it is working so far. Problem is:

As time goes by there appears to be a delay between I issue the play command on the stream and I actually see it in the video on client side.

Any ideas why this might happen?

Thanks in advance

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    January 11, 2011

    Delay can be for various reasons, it can be because of network latency or it can be because of Aggregate messages. But before we go further on tweaking buffertime and configuration parameters, can you try few code changes and see if that makes difference.

    If i understand you right, you always play recorded files,if that's the case , it would be advisable to modify your play function code from stream.play(filename, -2, -1, false); to stream.play(filename, 0, -1, false); (you should always use 0 when you for sure you want to play recorded file)

    Now i did not get clearly is one thing, its like when you click 1 or 2 as operator , do you want playlist to get reset and that "1" or "2" video to play immediately, if that's the case you may further want to modify last parameter of you play call to "true" from "false" in order to directly switch to new play and discard previous play. (I am not sure if this is your use case but thought of telling you in advance as i did not get your case very clearly with this regard)

    cashuaAuthor
    Participating Frequently
    January 11, 2011

    Hey there,

    Thanks for the answer first of all.

    I have tried almost all possible stream.play options. Doesnt help much.

    Scenario is this:  There seems to be a live person in the video. Operator clicks buttons with labels "1" or "2" on them. When clicked these videos should play right after the current idle video has finished playing. So I guess that's it for stream.play(filename, 0, -1, true).

    I guess the problem is this: Client side is trying to stream the video but sometimes there are bandwidth issues and it pauses while buffering. However after buffer is full it resumes from the last position where it has left. So in time these pause durations adds up to a big delay.

    What I need it to do is to behave like this is a live video. I mean think of this: We have a 1 hour long live concert. Band starts playing at 9 o'clock. Clients start watching exactly at the same time. But clients sometimes puases and buffers. These pause times add up to 30 mins. Concert finishes at 10 o'clock. But client playback finishes at 10:30. This shouldn't be the case with live play right ? Client also need to finish watching at 10 o'clock. Client should miss some of the live video but it should be synced with the actual concert.

    I am not sure if this makes sense to you ?

    Thanks

    Participating Frequently
    January 11, 2011

    Actually to be frank i did not get your use case very clearly. First of all tell me - is there any publishing going on or it is just playback of recorded files on server thus making them available as live?