98
Client-Side ActionScript Language Reference
NetStream.play()
Availability
■
Flash Player 6.
■
Flash Communication Server MX 1.0.
Usage
public play(
name
: Object [,
start
: Number[,
len
: Number[,
reset
:
Object]]])
Parameters
name
An identifying name for live data published by
NetStream.publish()
, a recorded file
name for playback, or
false
. If you pass
false
, the stream stops playing and any additional
parameters you send are ignored.
To play back FLV files, the default Flash file format for recorded streams, specify the name of
the stream without a file extension (for example,
"bolero"
). To play back MP3 files that
you’ve stored on the server or the ID3 tags of MP3 files, you must precede the stream name
with
mp3:
or
id3:
—for example,
"mp3:bolero"
or
"id3:bolero"
. For more information on
playing MP3 files, see
Developing Media Applications
.
start
An optional numeric parameter that specifies the start time, in seconds. This
parameter can also be used to indicate whether the stream is live or recorded.
■
The default value for
start
is -2, which means that Flash first tries to play the live stream
specified in
name
. If a live stream of that name is not found, Flash plays the recorded
stream specified in
name
. If neither a live nor a recorded stream is found, Flash opens a live
stream named
name
, even though no one is publishing on it. When someone does begin
publishing on that stream, Flash begins playing it.
■
If you pass -1 for
start
, Flash plays only the live stream specified in
name
. If no live
stream is found, Flash waits for it indefinitely if
len
is set to -1; if
len
is set to a different
value, Flash waits for
len
seconds before it begins playing the next item in the playlist.
■
If you pass 0 or a positive number for
start
, Flash plays only a recorded stream named
name
, beginning
start
seconds from the beginning of the stream. If no recorded stream is
found, Flash begins playing the next item in the playlist immediately.
■
If you pass a negative number other than -1 or -2 for
start
, Flash interprets the value as
if it were -2.