Stream Object


The Stream object gives you control over all streams in the Application instance. This object lets you chain servers together to increase user and bandwidth capacity. It also allows you to create play lists, or control the source of any stream. A stream is a one-way flow of data over a NetConnection.

To enable Code Hints and Code Completion in Dreamweaver MX, use the suffix _stream in the name of the SharedObject variable.

Stream Methods

The Stream methods are as follows :

Stream.clear()

Removes a recorded stream (FLV) file created by either the server or a client from the application instance.

Stream.get(name)

Creates or references a stream by name. This method also insatiates the Stream object to your ActionScript variable.

name The name of the stream to create or access.
Stream.length(name)

Returns the length (in seconds) of a pre-recorded stream (FLV). You can use this method without the .get method to return the length of a pre-recorded stream that is not being accessed.

name The name of the FLV file (without the FLV extension).
Stream.play(streamName, [startTime, length, reset, remoteConnection])

The Play command publishes a single recorded stream, or can publish a live stream from a local or remote source. Multiple play methods can be strung together to create a play list.

streamName The live or pre-recorded (FLV) stream to publish.
startTime An integer referencing the playback start position in seconds.
length An integer defining the length of play in seconds. A value of (-1) publishes a live stream as long as it exists.
reset A Boolean value; when true, it resets the stream.
remoteConnection Used to access streams in other application instances, or on remote communication servers. This can be used for "chaining" servers together.
Stream.record(recordappendfalse)

Records the stream to an FLV file. The contents of the stream are determined by a series of play methods. This stream can be used later for playback. The name of the FLV file is determined by the .get method.

record (flag) Overwrites any FLV file with the same name.
append (flag) Appends any FLV file with the same name.
false (flag) Stops recording.

Stream.send(handlerName, [p1, , pN])

Used to broadcast a message to all subscribers of the stream. This method invokes functions defined in the stream instance on each subscribed client.

handlerName Call a custom function defined inside the stream (or NetStream) Object in client-side ActionScript.
p1, ..., pN Custom parameters sent by the server to all stream subscribers.
stream.setBufferTime(seconds)

Allocates the amount of memory to handle pre-loading of a stream before publishing (playing). This command sends a message to the stream publisher source that the size has been changed.

seconds The amount of time to reserve for buffering.
Stream Properties

stream.buffertime returns the length of time in seconds that a stream will be stored before playing begins.

Stream.name returns the unique string used for a live stream.

Stream Event

Stream.onStatus invoked when the status of the subscribed stream changes.



Macromedia Flash Communication Server MX
Macromedia Flash Communication Server MX
ISBN: 0735713332
EAN: 2147483647
Year: 2002
Pages: 200
Authors: Kevin Towes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net