You want to publish a live stream without recording it.
Create a net stream, attach the audio and/or video to the stream using attachAudio( ) and/or attachVideo( ), then call the NetStream.publish( ) method and specify "live" as the recording mode.
The procedure to publish a live stream is the same as that of publishing a recorded stream (see Recipe 14.9) except that you specify the mode as "live" when you call the publish( ) method. Live streams are not recorded and are available only as they are being published.
Here is an example that publishes a live stream called "livePresentation":
// Establish the net connection. myConnection = new NetConnection( ); myConnection.connect("rtmp:/myApplication/"); // Create a net stream using a net connection named myConnection. publishLive_ns = new NetStream(myConnection); // Attach the camera and microphone data to the net stream. publishLive_ns.attachAudio(Microphone.get( )); publishLive_ns.attachVideo(Camera.get( )); // Publish the stream as live content. publishLive_ns.publish("livePresentation", "live");
If not specified, the recording mode defaults to "live". Therefore, the last line of the example could also be written as:
To publish a live stream and archive it for subsequent playback, see Recipe 14.9.