Macromedia flash media server 2-client-side actionscript language reference for flash media server 2 Benutzerhandbuch

Seite von 156
NetStream class
103
You don’t use this command when you want to let a subscriber play a stream that has already 
been published and recorded. For example, assume you have recorded a stream named 
“allAboutMe.”
 To enable someone to play it back, you need only open a stream for the 
subscriber to use:
var publish_ns:NetStream = new NetStream(my_nc);
var subscribe_ns:NetStream = new NetStream(my_nc);
subscribe_ns.play("allAboutMe");
When you record a stream, Flash creates an FLV file and stores it in a subdirectory of the Flash 
Media Server applications directory on the server. Each stream is stored in a directory whose 
name is the same as the 
instanceName
 value passed to 
. Flash 
creates these directories automatically; you don’t have to create one for each instance name. 
For example:
/* Connect to a specific instance of an app that is stored in
a directory named "lectureSeries" in your applications directory.
A file named "lecture.flv" is stored in a subdirectory named
"...\yourAppsFolder\lectureSeries\streams\Monday". */
var my_nc:NetConnection = new NetConnection();
my_nc.connect("rtmp://server.domain.com/lectureSeries/Monday");
var my_ns:NetStream = new NetStream(my_nc);
my_ns.publish("lecture", "record");
/* Connect to a different instance of the same app 
but issue an identical publish command.
A file named "lecture.flv" is stored in a subdirectory named
"...\yourAppsFolder\lectureSeries\streams\Tuesday". */
var my_nc:NetConnection = new NetConnection();
my_nc.connect("rtmp://server.domain.com/lectureSeries/Tuesday");
var my_ns:NetStream = new NetStream(my_nc);
my_ns.publish("lecture", "record");
If you don’t pass a value for 
instanceName
name
.flv is stored in a subdirectory named 
“...\yourAppsFolder\appName\streams\_definst_” (for “default instance”). For more 
information on using instance names, see 
For information on 
playing back FLV files, see 
This method can invoke 
 with a number of different information 
objects. For example, if someone is already publishing on a stream with the specified name, 
 is called with a 
code
 property of 
NetStream.Publish.BadName
. For 
more information, see