vendredi 17 juin 2016

How to run a method when onPublish is triggered in Adobe Media Server?

I have the following code inside Adobe Media Server's main.asc (latest version, 5.0.10 I think):

application.onPublish = function (clientObj, streamObj) {
  for (var i = 0; i < application.clients.length; i++){
    application.clients[i].call("streamConnected");
  }
}

And this code inside my ActionScript (3.0) file, connected to my flash file:

nc = new NetConnection();

nc.addEventListener(NetStatusEvent.NET_STATUS, onConnectionStatus);
nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
nc.client = { onBWDone: function():void{}, streamConnected: function():void{} };
nc.connect(videoURL);

...

public function streamConnected(...rest):void {
  trace("Stream Connected");
}

I'm not too sure what my code means - most of it has been sourced from various sections of the Internet, so any help would be greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire