Stream class

Availability

Flash Communication Server MX.

The Stream class lets you handle each stream in a Flash Media Server application. A stream is a one-way connection between Flash Player and Flash Media Server, or between two servers. Flash Media Server automatically creates a Stream object with a unique name when NetStream.play or NetStream.publish are called in a client-side script. You can also create a stream in server-side ActionScript by calling Stream.get(). A user can access multiple streams at the same time, and there can be hundreds or thousands of Stream objects active at the same time.

You can use the properties and methods of the Stream class to shuffle streams in a playlist, pull streams from other servers, and play and record streams.

You can also use the Stream class to play MP3 files over a stream, as well as ID3 tags associated with MP3 files.

You can create other Stream properties of any legal ActionScript type, including references to other ActionScript objects, for a particular instance of the Stream class. The properties are available until the stream is removed from the application.

For more information about streams, see the NetStream class entry in the Client-Side ActionScript Language Reference for Flash Media Server 2.

Property summary for the Stream class

Property (read-only)

Description

Stream.bufferTime

Indicates how long to buffer messages before a stream is played.

Stream.name

The unique name of a live stream.

Stream.syncWrite

A Boolean value that controls when a stream writes the contents of the buffer to a FLV file when the stream is recording.

Method summary for the Stream class

Method

Description

Stream.clear()

Deletes a stream previously recorded by the server.

Stream.flush()

Flushes a stream.

Stream.get()

Static; returns a reference to a Stream object.

Stream.length()

Static; returns the length of a recorded stream in seconds.

Stream.play()

Controls the data source of the Stream object.

Stream.record()

Records all the data going into the stream.

Stream.send()

Sends a call with parameters to all subscribers on a stream.

Stream.setBufferTime()

Sets the length of the buffer time in seconds.

Stream.setVirtualPath()

Sets the virtual directory path for video stream playback.

Stream.size()

Static; returns the size of the stream in bytes.

Event handler summary for the Stream class

Event handler

Description

Stream.onStatus

Called when there is a change in status.