The NetStream object opens a one-way streaming channel over a NetConnection.


Can be created with method new:

Lib.Media.Net.NetStream.new(connection, peerID)

Creates a stream that you can use to play media files and send data over a NetConnection object.

connection - A NetConnection object.

peerID - (default = "connectToFMS") - not in use, reserved


Created NetStream object has properties:


bytesTotal

[read-only] The total size in bytes of the file being loaded into the application.

bytesLoaded

[read-only] The number of bytes of data that have been loaded into the application.

client

Specifies the object on which callback methods are invoked to handle streaming or file data.

objectEncoding

[read-only] The object encoding for this NetStream object.

peerStreams

[read-only] An array object that holds all of the subscribing NetStream instances that are listening to this publishing NetStream instance.

time

[read-only] The position of the playhead, in seconds.

soundTransform

Controls sound in this NetStream object. (SoundTransform)


methods:

attach(connection)

Attaches a stream to a new NetConnection object.

connection - NetConnection object.

seek(offset)

Seeks the keyframe (also called an I-frame in the video industry) closest to the specified location.

offset - The approximate time value, in seconds, to move to in a video file.

close()

Stops playing all data on the stream, sets the time property to 0, and makes the stream available for another use.


dispose()

Releases all the resources held by the NetStream object.


pause()

Pauses playback of a video stream.


play(inFilename, startSeconds, lenSeconds, p4, p5)

Plays a media file from a local directory or a web server; plays a media file or a live stream from Flash Media Server.

inFilename - file name

startSeconds - start position to play (default 0)

lenSeconds - how many seconds will be played (default -1, play all)

p4...p5 - reserved, not in use

togglePause()

Pauses or resumes playback of a stream.


resume()

Resumes playback of a video stream that is paused.


receiveAudio(flag)

Specifies whether incoming audio plays on the stream.

flag - Specifies whether incoming audio plays on the stream (true) or not (false). The default value is true. If the specified stream contains only audio data, NetStream.time stops incrementing when you pass false.

receiveVideo(flag)

Specifies whether incoming video plays on the stream.

flag - Specifies whether incoming video plays on this stream (true) or not (false). The default value is true. If the specified stream contains only video data, NetStream.time stops incrementing when you pass false.

onPeerConnect(subscriber)

Invoked when a peer-publishing stream matches a peer-subscribing stream.

subscriber - NetStream

Created with the Personal Edition of HelpNDoc: Easy EPub and documentation editor