
160
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
Controls the data source of a stream with an optional start time, duration, and reset flag to flush any previously playing
stream. Call
play() to do the following:
• Chain streams between servers.
• Create a hub to switch between live streams and recorded streams.
• Combine streams into a recorded stream.
You can combine multiple streams to create a playlist for clients. The Stream.play() method behaves differently
from the
NetStream.play() method on the client side. A server-side call to Stream.play() is similar to a client-side
call to
NetStream.publish(); it controls the source of data coming into a stream. When you call Stream.play() on
the server, the server becomes the publisher. Because the server has higher priority than the client, the client is forced
to unpublish from the stream if the server calls a
play() method on the same stream.
If any recorded streams are included in a server playlist, you cannot play the server playlist stream as a live stream.
Note: A stream that plays from a remote server by means of the NetConnection object is considered a live stream.
You do not need to wait for "NetStatus.Connection.Success" when connecting to another Adobe Media Server
from Server-Side Actionscript. The server waits for the connection to complete before it attempts to use the connection
for
Stream.play(). However, you may want to monitor the NetStatusEvent so that you can handle a failed
connection.
To delete a Stream object, use the delete operator to mark the stream for deletion. The script engine deletes the object
during its garbage collection routine.
// Initialize the Stream object.
s = stream.get("foo");
// Play the stream.
s.play("name", p1, ... pN);
// Stop the stream.
s.play(false);
// Mark the Stream object for deletion during server garbage routine.
delete s;
Availability
Flash Communication Server 1
Parameters
streamName A string indicating the name of the stream. Use the following syntax:
startTime A number indicating the playback start time, in seconds. If no value is specified, the value is -2. If
startTime is -2, the server tries to play a live stream with the name specified in streamName. If no live stream is
available, the server tries to play a recorded stream with the name specified in
streamName. If no recorded stream is
File format Syntax Example
FLV Specify the stream name as a string, without a filename
extension.
s.play("fileName")
MP3 Specify the stream name as a string, with prefix mp3: or id3:,
respectively, and without a filename extension.
s.play("mp3:fileName")
s.play("id3:fileName")
MPEG-4-based files (such as
F4V, MP4)
Specify the stream name as a string with the prefix mp4:. Use
a file extension if the file on the server has a file extension. The
prefix indicates to the server that the file is in the MPEG-4 Part
12 container format.
s.play("mp4:fileName")
s.play("mp4:fileName.mp4")
s.play("mp4:fileName.f4v")
Komentáře k této Příručce