Adobe 65029121 - Flash Media Streaming Server Developer's Manual page 52

Developer's guide
Hide thumbs Also See for 65029121 - Flash Media Streaming Server:
Table of Contents

Advertisement

Server 1 rebroadcasts the live stream to Server 2 and Server 3 with a
4
5
Subscribers connecting to Server 2 and Server 3 receive the same live stream.
The application receives an
6
To use multipoint publishing, you need to write server-side code in a main.asc file.
Multipoint publishing
To use multipoint publishing, you need to write both client and server-side code.
Note: See the LiveStreams sample, LiveStreams.as (in ActionScript 3.0) and main.asc (in Server-side ActionScript), at
www.adobe.com/learn_fms_docs_en
Note:
Write the client-side code
In your client, publish a stream using
1
private function publishLiveStream():void {
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
camera = Camera.getCamera();
mic = Microphone.getMicrophone();
if (camera != null && mic != null) {
camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
ns.attachCamera( camera );
ns.attachAudio( mic );
// start publishing
// triggers NetStream.Publish.Start
ns.publish( "localNews", "record" );
} else {
trace("Please check your camera and microphone");
}
}
Write the server-side code
1
In your main.asc file on the server, define an
name and connects to the remote server:
// called when the client publishes
application.onPublish = function( client, myStream ) {
trace(myStream.name + " is publishing" );
nc = new NetConnection();
nc.onStatus = function (info) {
if (info.code == "NetConnection.Connect.Success") {
ns = new NetStream(nc);
ns.setBufferTime(2);
ns.attach(myStream);
ns.publish( myStream.name, "live" );
}
nc.connect( "rtmp://xyz.com/myApp" );
}
}
Calling
NetStream.publish()
application.onUnpublish
under the Developer Guide.
NetStream.publish()
application.onPublish()
publishes the stream from your server to the remote server.
NetStream.publish()
event when the client stops publishing.
and a stream name:
event handler that accepts the stream
ADOBE FLASH MEDIA SERVER
Developer Guide
method.
49

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash media server

Table of Contents