Skip navigation
Currently Being Moderated

netstream seek during buffer flush

Jul 30, 2012 2:18 PM

Hi folks,

 

Quick question... I am developing a simple AIR video player but I am having small issues with seeking while the buffer is being flushed.

 

I am listening to and tracing the NetStatusEvents, and I noticed that when the video begins to approach the end of the video the buffer starts to Flush (NetStream.Buffer.Flush).  But if I try to seek during this time, the Buffer Flush trace keeps firing, and most of the time if I continue to scrub (seek) the video while all the Flushes are being fired I end up getting a NetStream.Play.Stop event (which I have set to stop the video).

 

The only work around I can think of (and implemented) was to disable my scrubber once the NetStream.Buffer.Flush event has been fired.  But I thought I would check to see if any body else has seen such a thing?

 
Replies
  • Currently Being Moderated
    Jul 31, 2012 7:29 AM   in reply to streamworksaudio

    You might want to try enabling inBufferSeek:

     

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/net/NetStream.html#inBufferSeek

     

    It might retain a bit longer. Also shortening your overall buffer length will reduce this issue to that amount of time.

     

    Lastly, if it's just a "get around it" issue you might consider adding a "flag" of some sort to tell yourself when those events fire off. Then when a NetStream.Buffer.Flush fires, you set the flag to true to let yourself know it's emptying. Then when the NetStream.Play.Stop is fired off, you simply check that flag and if it's true you know you're in a flush and can run a ns.play() to make sure it plays after the seek.

     

    Just remember to reset that flag when the buffer starts to fill or you do a seek so the NetStream.Play.Stop functions as normal.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 31, 2012 11:27 AM   in reply to streamworksaudio

    Code operates at gigaflop speed so as long as you have the right conditions setting the right flag at the right time you should be able to avoid the issue. A HUGE amount of code can be completed in just a seconds worth of time. It might even be worth using a timer to put a "hold" on interaction for a single second before the user can proceed, only after the buffer emptying process begins so you don't bother normal seeks.

     

    Playing off the local filesystem renders the buffer size moot. You are getting events for it however. You may as well set the buffer time to 0 and perhaps the event will only fire at the completion of the video.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 31, 2012 12:53 PM   in reply to streamworksaudio

    It's just bufferTime:

     

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/net/NetStream.html#bufferTime

     

    The default is actually already 0.1. It mentions you can set it to 0 for live streaming content but playback off a desktop is pretty much the same, so I'd probably set it to 0 anyhow.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 1, 2012 5:42 AM   in reply to streamworksaudio

    bufferTime is a property of a NetStream object, like .x and .y are properties of a MovieClip. You set properties like so:

     

    myNetStream.bufferTime = 0;

     

    A method is a function and only then do you use your syntax with parenthesis around arguments. The error description mentions it's not a method (because it's a property).

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 1, 2012 11:31 AM   in reply to streamworksaudio

    If it were being downloaded it'd work but in your situation I think 1.5 seconds worth of "seek disable" time for the buffer to empty isn't so bad .

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points