
74
Example 2:
// To play and switch between live and recorded streams:
// Suppose we have two live streams, live1 and live2,
// and three recorded streams, record1, record2, and record3.
// The play order is record1, live1, record2, live2, and record3.
myConnection = new NetConnection();
myConnection.connect("rtmp://localhost/appName/appInstance");
// Create a NetStream for playing
dstStream = new NetStream(myConnection);
myVideoObject.attachVideo(dstStream);
// Play record1
dstStream.play("record1", 0, -1, false);
// Switch from record1 to live1.
// live1 will start to play after record1 is done
dstStream.play("live1", -1, 5, false);
// Switch from live1 to record2.
// record2 will start to play after live1 plays for 5 seconds.
dstStream.play("record2", 0, -1, false);
// Interrupt the current play and play a segment in record1 again
// (we can implement a seek by this)
dstStream.play("record1", 1, 5, true);
See also
NetStream.close, NetStream.pause, NetStream.publish
NetStream.publish
Availability
• Flash Player 6.
• Flash Communication Server MX.
Usage
mystream.publish(whatToPublish | false [, howToPublish])
Parameters
whatToPublish A string that identifies the stream. If you pass false or an empty string, the
publish operation stops. Subscribers to this stream must pass this same name when they call
NetStream.play.
howToPublish An optional string that specifies how to publish the stream. Valid values are
"record", "append", and "live". The default value is "live".
• If you pass "record" for howToPublish, Flash publishes and records live data, saving the
recorded data to a new file named
whatToPublish.flv. The file is stored on the server in a
subdirectory within the directory containing the server application. If the file already exists,
it is overwritten. For more information on where recorded streams are stored, see the
description below.
Comentarios a estos manuales