« youtubeAPI(JP) | Main | Genetic Algorythm Part2 »

NetStream.play() method

The play() method has a number of optional parameters.

The first parameter must be either a relative URI or the value false, which stops the current stream from playing.

ns.play(URI | false, [, start [, length [, flushPlaylist]]]);

The start parameter
-2 or omitted
plays the live stream at the URI.
plays the recorded stream at that location if the live stream is not found.
waits for the stream to be published if a recored stream is also not found.

-1
plays only a live stream at the URI.
waits for the stream to be published if a recored stream is not found.

0
plays only a recorded stream at the URI from its beginning.
returns an infomation object to NetStream.onStatus() if a recored stream is not found.

Greater than 0
plays only a recorded stream at the URI.
indicates how many seconds into the stream to begin playing.
returns an infomation object to NetStream.onStatus() if a recored stream is not found.

The length parameter
indicates how many seconds the stream should play. The stream plays until it ends if it is -1 or omitted. The length can be limited for live streams to play with the length parameter.

The Playlist
To create a playlist in the server can provide that the server treats a sequence of recorded streams as a continuous stream.

ns.play("intro", 5, 15, false);
ns.play("body", 5, 18, false);
ns.play("ending", 10, 7, false);

Post a comment