Skip to main content
Participant
August 31, 2009
Question

Problem while switching between live and recorded stream

  • August 31, 2009
  • 2 replies
  • 949 views

Hi all,

I am new to FMS. I apologize if this is ridiculously simple or poorly phrased.

I am working on an application which acts as a web TV. It will telecast a live stream and switches to recorded stream on certain point of time. And once the recorded stream gets over it switches to live stream. The switching from live to recorded is done using 'NetConnection.call()' method which will notify the server app to switch the streams.

The application works fine with exact point of switch. But every time I switch between recorded stream and live stream the buffer starts accumulating instead of constant time.Hence the recorded stream switching gets delayed after each switch. I have tried 'Stream.flush()' and 'Stream.setBufferTime(0)' to remove the delay. But none of them helped.

I am attaching the server side application which does the switching. Client side doesnt have anything apart from 'VideoDisplay' whose source is same as the one published from server app. Other client is used for triggering the switch of stream as mentioned above.

Any suggestions or links would be of great help.

Thanks in advance,
gnraghu

    This topic has been closed for replies.

    2 replies

    calmchessplayer
    Inspiring
    August 31, 2009

    What i would do is create a header for the recorded video then when the switch takes place i would delay the switch untill currentFPS is above 0 or set an explicit buffer and wait untill  buffer seconds has passed before i made the actual switch from live to recorded.....think of it as createing a "live buffer"

    August 31, 2009

    I've found this to be a client side issue... no settings on the server side will correct it. The problem is that when the stream source switches, the flashplayer treats is as a new stream, and rebuffers.

    The only fix I've found is to programatically empty the buffer when the source change happens. In my onPlayStatus event handler, I look for a code of NetStream.Play.Complete (that code is dispatched each time the source on the stream changes). When found, I drop the buffer to 0 (to clear the buffer), and then to 0.1.

    Then, in my NetStatusEvent handler for the netstream, I set the buffer back to the desired buffer length as soon as I get a NetStream.Buffer.Full code so the buffer can fill back up to the desired size.