
Client-Side Communication ActionScript 65
Parameters
myRTMPConnection A NetConnection object that is using the Real-Time Messaging Protocol
(RTMP) to communicate with the Flash Communication Server.
Returns
A NetStream object.
Description
Constructor; creates a stream that can be used for publishing (sending) or playing (receiving) data
through the specified server connection.
You can’t publish and play data over the same stream at the same time. For example, if you are
publishing on a stream and then call
NetStream.play, an implicit NetStream.close method is
called; the publishing stream then becomes a subscribing stream.
However, you can create multiple streams that run simultaneously over the same connection: one
stream publishes and another stream plays.
Example
The following example shows how a publishing client and a subscribing client can connect to the
Flash Communication Server and then open an application stream for sending (publishing) or
receiving (playing) data over this connection.
// Publishing client contains this code.
connection = new NetConnection(); // create NetConnection object
connection.connect("rtmp://myRTMPServer.myDomain.com/app"); // connect to
server
myStream = new NetStream(connection); // open app stream within connection
myStream.publish("myWeddingVideo"); // publish data over this stream
// Subscribing client contains this code.
// Note that the connection and stream names are the same as those
// used by the publishing client. This is neither required nor prohibited,
// because the scripts are running on different machines.
// However, the parameters used with connect() and play() below
// must be the same as those used with connect() and publish() above.
connection = new NetConnection();
connection.connect("rtmp://myRTMPServer.myDomain.com/app");
myStream = new NetStream(connection);
myStream.play("myWeddingVideo");
For more examples, see “NetStream (object)” on page 62 and Video.attachVideo.
See also
NetConnection (object), NetStream.attachAudio, NetStream.attachVideo,
NetStream.play, NetStream.publish, Video.attachVideo
NetStream.attachAudio
Availability
• Flash Player 6.
• Flash Communication Server MX.
Usage
myStream.attachAudio(source)
Commentaires sur ces manuels