Buffering Audio/Video Streams

Buffering a video stream helps ensure that the video plays smoothly, without interruption.

To create the best experience for users, monitor the progress of a video and manage buffering as the video downloads. You may need to set different buffer sizes for different users, to ensure the best playback experience. One choice is to detect a user's bandwidth (http://livedocs.adobe.com/flashmediaserver/3.0/hpdocs/help.html?content=00000070.html#1046682) and set an initial buffer size based on it.

While the stream is playing, you can also detect and handle netStatus events. For example, when the buffer is full, the netStatus event returns an info.code value of NetStream.Buffer.Full. When the buffer is empty, another event fires with a code value of NetStream.Buffer.Empty. When the data is finished streaming, the NetStream.Buffer.Flush event is dispatched. You can listen for these events and set the buffer size smaller when empty and larger when full.