
25
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
Example
For an example of distributing peer lookup requests across multiple servers, see Distribute peer lookup requests across
multiple servers.
See also
application.sendPeerRedirect(), Client.introducePeer()
application.onPublish()
application.onPublish = function (clientObj, streamObj){}
Invoked when a client publishes a stream to an application. Use this event handler to send traffic to other servers when
you’re building a large-scale live broadcasting application; this is called multipoint publishing. For example, you can
support subscribers in multiple geographic locations by sending traffic from the origin server (Server A) in one city to
two origin servers in two different cities (Server B and Server C). The following is the workflow for such a scenario:
1 A client publisher connects to Server A and starts publishing.
2 Server A receives notifications from the event handler application.onPublish() in a server-side script.
3 Inside the onPublish() handler, create two NetStream objects to Server B and Server C.
4 Call the NetStream.publish() method to redirect the publishing data from Server A to Server B and Server C.
5 Subscribers connecting to Server B and Server C get the same live stream.
In this example, the publishing client connects and publishes only to Server A. The rest of the data flow is handled by
logic in the server-side script.
Note: You cannot change Client object properties in this handler.
Availability
Flash Media Server 3
Parameters
clientObj A Client object; the client publishing the stream to the application.
streamObj A Stream object; the stream being published to the application.
Returns
Server ignores any return value.
application.onStatus()
application.onStatus = function (infoObject){}
Property Data type Description
targetPeerID String The peerID of the target peer. The initiating peer is attempting to
look up and connect to the target peer.
initiatorAddress String The IP address of the initiating client. Send redirect information to
this address.
tag ByteArray A value that uniquely identifies this lookup request.
interfaceID Number Identifies the RTMFP interface on which the request was received.
Comentários a estes Manuais