User Guide
100 Client-Side ActionScript Language Reference
You can use the optional parameters of this method to control various aspects of playback
behavior. The following table shows a few ways in which these values interact:
This method can invoke
NetStream.onStatus with a number of different information
objects. For example, if the specified stream isn’t found,
NetStream.onStatus is called with a
code property of NetStream.Play.StreamNotFound. For more information, see
NetStream.onStatus.
If you want to create a dynamic playlist that switches among different live or recorded
streams, call
play more than once and pass false for reset each time. Conversely, if you
want to play the specified stream immediately, clearing any other streams that are queued for
play, pass
true for reset.
Example
The following examples show some ways to use this method to play back live or recorded
streams.
Example 1:
var my_nc:NetConnection = new NetConnection();
my_nc.connect("rtmp://localhost/appName/appInstance");
var my_ns:NetStream = new NetStream(my_nc);
my_video.attachVideo(my_ns);
/* To play a live stream named "stephen" being published elsewhere
using the default values -- start time is -2, length is -1,
and flushPlaylists is true -- don’t pass any optional parameters.*/
my_ns.play("stephen");
/* to immediately play a recorded stream named record1
start len Flash Player behavior
(Default) (Default) Plays the live stream until it is no longer available. If a live
stream of the specified name is not found, Flash Player plays
a recorded stream until it ends.
-2 19 Plays a live stream for up to 19 seconds after it becomes
available. If a live stream of the specified name is not found,
Flash Player plays a recorded stream for 19 seconds.
15 19 Plays a recorded stream for 19 seconds, beginning 15
seconds from the beginning of the stream.
15 (Default) Plays a recorded stream, beginning 15 seconds from the
beginning of the stream, until the stream ends.
-1 (Default) Plays a live stream until it is no longer available.