
Client-Side Communication ActionScript 73
Description
Method; feeds streaming audio, video, and text messages being published on the Flash
Communication Server, or a recorded file stored on the server, to the client. This method is
available only to clients subscribed to the specified stream, not to the stream’s publisher.
To view video data, you must call a
Video.attachVideo method; audio being streamed with the
video will be played automatically. If audio-only data is being streamed, you must call a
MovieClip.attachAudio method to hear the audio.
You can use the optional parameters of this method to control various aspects of playback
behavior. The following table shows a few ways 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 flushPlaylists each time. Conversely, if you want
to play the specified stream immediately, clearing any other streams that are queued for play, pass
true for flushPlaylists.
Example
The following examples show some ways to use this method to play back live or recorded streams.
Example 1:
myConnection = new NetConnection();
myConnection.connect("rtmp://localhost/appName/appInstance");
dstStream = new NetStream(myConnection);
myVideoObject.attachVideo(dstStream);
// 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.
dstStream.play("stephen");
// To immediately play a recorded stream named record1
// starting at the beginning, for up to 100 seconds.
dstStream.play("record1", 0, 100, true);
start length 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, the 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, the 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.
Komentarze do niniejszej Instrukcji