
Client-Side Communication ActionScript 75
• If you pass "append" for howToPublish, Flash publishes and records live data, appending the
recorded data to a file named
whatToPublish.flv, stored on the server in a subdirectory
within the directory containing the server application. If no file named whatToPublish.flv is
found, it is created.
• If you omit this parameter or pass "live", Flash publishes live data without recording it. If
whatToPublish.flv exists, it will be deleted.
Returns
Nothing.
Description
Method; sends streaming audio, video and text messages from the client to the Flash
Communication Server, optionally recording the stream during transmission. This method is
available only to the publisher of the specified stream.
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:
publishStream = new NetStream(someConnection);
subscribeStream = new NetStream(someConnection);
subscribeStream.play("allAboutMe");
When you record a stream, Flash creates an FLV file and stores it in a subdirectory of the
FlashCom application directory on the server. Each stream is stored in a directory whose name is
the same as the
instanceName passed to NetConnection.connect. 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
nc = new NetConnection();
nc.connect("rtmp://server.domain.com/lectureSeries/Monday")
ns = new NetStream(nc);
ns.publish("lecture", "record")
// a file named "lecture.flv" is stored in a subdirectory named
// "...\yourAppsFolder\lectureSeries\streams\Monday"
// Connect to a different instance of the same app
// but issue an identical publish command
nc = new NetConnection();
nc.connect("rtmp://server.domain.com/lectureSeries/Tuesday")
ns = new NetStream(nc);
ns.publish("lecture", "record")
// a file named "lecture.flv" is stored in a subdirectory named
// "...\yourAppsFolder\lectureSeries\streams\Tuesday"
If you don’t pass a value for instanceName, whatToPublish.flv is stored in a subdirectory named
“...\yourAppsFolder\appName\streams\_definst_” (for “default instance”). For more information
on using instance names, see
NetConnection.connect. For information on playing back FLV
files, see
NetStream.play.
This method can invoke
NetStream.onStatus with a number of different information objects.
For example, if someone is already publishing on a stream with the specified name,
NetStream.onStatus is called with a code property of "NetStream.Publish.BadName". For
more information, see
NetStream.onStatus.
Kommentare zu diesen Handbüchern