Client-Side Communication ActionScript > NetStream.setBufferTime

 

NetStream.setBufferTime

Availability

Flash Player 6.

Flash Communication Server MX.

Usage

myStream.setBufferTime(numberOfSeconds)

Parameters

numberOfSeconds The number of seconds to be buffered before Flash stops sending data (on a publishing stream) or begins displaying data (on a subscribing stream). The default value is 0.

Description

Method; behavior depends on whether this method is called on a publishing or a subscribing stream.

For a publishing stream, this method specifies how long the outgoing buffer can grow before Flash starts dropping frames. On a high-speed connection, buffer time shouldn't be a concern; data will be sent almost as quickly as Flash can buffer it. On a slow connection, however, there might be a significant difference between how fast Flash buffers the data and how fast it can be sent to the client.

For example, suppose you set numberOfSeconds to 30, but after 30 seconds, only 5 seconds of data have been sent over the connection. Flash may stop sending data to the buffer until more data has been sent to the client. The client will receive the initial 30 seconds that were buffered but might lose some intervening frames before the next set of buffered data is displayed.

For a subscribing stream, this method specifies how long to buffer incoming data before starting to display the stream. For example, if you want to make sure that the first 15 seconds of the stream play without interruption, set numberOfSeconds to 15; Flash will begin playing the stream only after 15 seconds of data have been buffered.

When a recorded stream is played, if numberOfSeconds is zero, Flash sets it to a small value (approximately 10 milliseconds). If live streams are later played (for example, from a playlist), this buffer time persists—that is, numberOfSeconds remains non-zero for the stream.

See also

NetStream.bufferTime