Search code examples
flashflash-media-server

How can I listen for trace() statements on the Flash Media Server Administration API?


I am connected to the Flash Media Server Administration API via RTMPE on port 1111 and I'd like to monitor calls to trace() from the server side actionscript code.


Solution

  • Here's how it's done:

    var netConnection : NetConnection = new NetConnection();
    netConnection.connect( "rtmpe://fmsuri:1111", adminUsername, adminPassword );
    
    var netStream : NetStream = new NetStream( netConnection );
    netStream.client = { onLog: handleLog };
    netStream.play( "logs/application/appName/instanceName", -1 );
    
    function handleLog ( info : Object ) : void {
         trace( info[ "description" ] );
    }