I need a way to flush a NetStream object in Flash without destroying it

101 Views Asked by At

I have a Flash client that live-streams video over RTMP using NetStream. For some reason, Flash is ignoring the bufferTimeMax value, and under some circumstances bufferLength can grow to very large values. I cannot allow the buffer to grow to more than one second in size, so when it gets too large I need to flush the buffer. Right now the only method I have that works requires destroying the NetStream and NetConnection objects and reconnecting. The problem with this approach is that the app goes black while this happens, which is not acceptable.

I have tried the following approaches to flushing the buffer:

  1. Set bufferTime to zero, and then set it back to the desired value
  2. Seek to one second in the future
  3. close() the NetStream and then play() it again
  4. Create a new NetStream object while keeping the existing NetConnection

All of these methods fail for various reasons, usually by preventing video from playing at all.

0

There are 0 best solutions below