Skip to main content
Participant
October 8, 2008
Question

NetStream stops buffering

  • October 8, 2008
  • 2 replies
  • 1190 views
(Previously posted this in the Flex forum; realized this is a much better place for it...)

I'm using NetStream to play video off of my Flash Media Server. If I play a video that is shorter than a minute, I have no problems; the video plays smoothly.

If I play a video that is longer than a minute, then the video plays for approximately 2.5 seconds, then it freezes up and won't continue playing. Looking at the stream info messages, I see that it starts playing when the NetStream.Buffer.Full message is sent, then freezes when the NetStream.Buffer.Empty message is sent. I wait a long time, but another NetStream.Buffer.Full message never arrives. Additionally, when I look at the bandwidth usage in my FMS admin console, I see a large spike in BW usage when the buffer is first filled, then it drops down to 0 again (meaning the buffer is not being refilled after that).

Another puzzling aspect of this is if I set the bufferTime to 20 seconds, it will still only fill the buffer to about 2.5 seconds before it starts playing. If I set the bufferTime to 200 seconds (much greater than the length of the video), then the entire video will preload and it will play just fine. This is not really an acceptable solution, however, since I could be using this for some much longer videos.

Can anyone help me? Thanks in advance!
    This topic has been closed for replies.

    2 replies

    bswettAuthor
    Participant
    October 8, 2008
    I found the answer to this, in case anyone else has a similar problem. Turns out it didn't really matter how long the video was, but each video that had this problem had an incorrect duration in the metadata. (See also this thread: http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=578&threadid=1382766&enterthread=y) I found that the duration was set improperly when I recorded and/or played multiple videos on the same NetStream. Once I created a new NetStream each time, the problem went away.
    bswettAuthor
    Participant
    October 8, 2008
    More information:
    I've found that the stream does start filling the buffer, but that it takes way longer than I would expect. As I said, it stops playing about 2 seconds in, but if I wait another 70 seconds after it stops playing, then I get another buffer full message. However, instead of playing what was in the buffer normally, it played it at a very fast pace, so that those 20 seconds presumably stored in the buffer played for less than a second. It did this 3 times (reported Buffer Full, played video very fast, reported Buffer Empty and then paused again) until the entire video was played.

    I have some output here which may help diagnose the problem. It shows all the Stream Status mesages I am getting, plus events from my 1-second timer (which is used to update the progress bar). The Timer Events (redundant ones were removed) also show some key information from the NetStream object.

    Stream Status: NetStream.Play.Start stream.time: 180.598
    onMetaData, video duration is: 180.598
    Stream Status: NetStream.Unpause.Notify stream.time: 0.039
    Stream Status: NetStream.Buffer.Full stream.time: 0.039
    Timer Event: 1 seconds out of 180 total seconds
    bufferLength: 2.717 bufferTime: 20
    currentFPS: 17.204301075268816 liveDelay: 0
    stream.time: 97.203
    Timer Event: 2 seconds out of 180 total seconds
    bufferLength: 1.656 bufferTime: 20
    currentFPS: 14.375561545372866 liveDelay: 0
    stream.time: 98.259
    Timer Event: 3 seconds out of 180 total seconds
    bufferLength: 0.635 bufferTime: 20
    currentFPS: 14.349775784753364 liveDelay: 0
    stream.time: 99.279
    Timer Event: 4 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 10.973936899862826 liveDelay: 0
    stream.time: 99.943
    Stream Status: NetStream.Buffer.Empty stream.time: 99.943
    Timer Event: 5 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 6.420545746388443 liveDelay: 0
    stream.time: 99.943
    Timer Event: 6 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 4.513399153737659 liveDelay: 0
    stream.time: 99.943
    Timer Event: 7 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 3.484320557491289 liveDelay: 0
    stream.time: 99.943
    Timer Event: 8 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 0 liveDelay: 0
    stream.time: 99.943

    ... (Timer Events 9-75 hidden)

    Timer Event: 76 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 0 liveDelay: 0
    stream.time: 121.546
    Stream Status: NetStream.Buffer.Full stream.time: 121.546
    Stream Status: NetStream.Buffer.Empty stream.time: 121.546
    Timer Event: 77 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 0 liveDelay: 0
    stream.time: 121.546

    ... (Timer Events 78-95 hidden)

    Timer Event: 96 seconds out of 180 total seconds
    bufferLength: 0.798 bufferTime: 20
    currentFPS: 0 liveDelay: 0
    stream.time: 121.546
    Stream Status: NetStream.Buffer.Full stream.time: 142.996
    Stream Status: NetStream.Buffer.Empty stream.time: 142.996
    Timer Event: 97 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 0.7156595249809903 liveDelay: 0
    stream.time: 142.996
    Timer Event: 98 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 0.684404140645051 liveDelay: 0
    stream.time: 142.996
    Timer Event: 99 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 0.6552006552006552 liveDelay: 0
    stream.time: 142.996
    Timer Event: 100 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 0.6285602042820664 liveDelay: 0
    stream.time: 142.996
    Timer Event: 101 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 0 liveDelay: 0
    stream.time: 142.996

    ... (Timer Events 102-116 hidden)

    Timer Event: 117 seconds out of 180 total seconds
    bufferLength: 17.822 bufferTime: 20
    currentFPS: 0 liveDelay: 0
    stream.time: 142.996
    Stream Status: NetStream.Buffer.Full stream.time: 153.7
    Timer Event: 118 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 0 liveDelay: 0
    stream.time: 163.143
    Stream Status: NetStream.Buffer.Empty stream.time: 163.143
    Timer Event: 119 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 0 liveDelay: 0
    stream.time: 163.143

    ... (Timer Events 120-135 hidden)

    Timer Event: 136 seconds out of 180 total seconds
    bufferLength: 0 bufferTime: 20
    currentFPS: 0 liveDelay: 0
    stream.time: 163.143
    Stream Status: NetStream.Play.Stop stream.time: 163.143
    Timer Event: 137 seconds out of 180 total seconds
    bufferLength: 16.891 bufferTime: 20
    currentFPS: 0 liveDelay: 0
    stream.time: 180.598
    Stream Status: NetStream.Buffer.Flush stream.time: 180.598
    Timer Event: 138 seconds out of 180 total seconds
    bufferLength: 12.134 bufferTime: 20
    currentFPS: 51.90311418685121 liveDelay: 0
    stream.time: 180.598
    Timer Event: 139 seconds out of 180 total seconds
    bufferLength: 7.154 bufferTime: 20
    currentFPS: 45.87155963302752 liveDelay: 0
    stream.time: 180.598
    Timer Event: 140 seconds out of 180 total seconds
    bufferLength: 1.743 bufferTime: 20
    currentFPS: 52.44755244755245 liveDelay: 0
    stream.time: 180.598