Skip to main content
October 6, 2010
Question

Can I buffer all the video content before playing it?

  • October 6, 2010
  • 1 reply
  • 2553 views

I just had a very bad user experience here:

http://www.fmsguru.com/showtutorial.cfm?tutorialID=20

The Loading... text appears every 1 second.

Is it possible to buffer all the video content before playing it? Or at least a portion of the video content when playback, and at the same time display the percentage of video content loaded?

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    October 6, 2010

    I am little confused here : - are you talking about the specific tutorial video or are you talking about how to do it for general playback.

    I think if its first then there is not much i can say , it might be because your network is slow and its taking time to buffer - there is not much you can do if client application itself has set less buffer.

    Now coming to second question - building application. I mean its not point in building streaming application where it buffers all the data before playback - you might as well go for pure progressive download. What i would suggest is set slightly higher buffer time so that you might have to wait for sometime to start the playback but then it should be smooth playback.

    Display part i think Greame has covered well in his tutorial which you mentioned - you can reuse same kind of code

    October 6, 2010

    Yes,all the effort is for smooth playback.

    What I want to achieve is (which is the default behavior of most movie players,but sadly not the case for flash player):

    1.when a specific button is clicked,pause the playback, and buffer it in background

    2.after the 2nd click to the button,playback starts again.

    But how to do step1?

    Participating Frequently
    October 6, 2010

    I am just pasting piece of livedocs here:

    "Starting with Flash Player 9.0.115.0, Flash Player no longer clears the buffer when NetStream.pause() is called. Before Flash Player 9.0.115.0, Flash Player waited for the buffer to fill up before resuming playback, which often caused a delay.

    For a single pause, the NetStream.bufferLength property has a limit of either 60 seconds or twice the value of NetStream.bufferTime, whichever value is higher. For example, if bufferTime is 20 seconds, Flash Player buffers until NetStream.bufferLength is the higher value of either 20*2 (40), or 60. In this case it buffers until bufferLength is 60. If bufferTime is 40 seconds, Flash Player buffers until bufferLength is the higher value of 40*2 (80), or 60. In this case it buffers until bufferLength is 80 seconds.

    The bufferLength property also has an absolute limit. If any call to pause() causes bufferLength to increase more than 600 seconds or the value of bufferTime * 2, whichever is higher, Flash Player flushes the buffer and resets bufferLength to 0. For example, if bufferTime is 120 seconds, Flash Player flushes the buffer if bufferLength reaches 600 seconds; if bufferTime is 360 seconds, Flash Player flushes the buffer if bufferLength reaches 720 seconds.

    Tip: You can use NetStream.pause() in code to buffer data while viewers are watching a commercial, for example, and then unpause when the main video starts."

    So if you see you don't have to do anything much for it to buffer when you pause - its just that you need to set proper bufferTime.