Skip to main content
Participant
January 13, 2010
Answered

Failed to load application instance publishLive/live.

  • January 13, 2010
  • 2 replies
  • 1065 views

Complete log error is (_defaultRoot_, _defaultVHost_) : Failed to load application instance publishLive/live..  Flash Admin Server and Flash Media Server are running on local machine.  When testing I get [object NetConnection]: NetConnection.Connect.Failed.  When I remove the main.asc file it works...what's going on there?  I had this working at one point...my main.asc is below.

var nc;
var ns;
var nsr;

// Called when a client connects
application.onConnect = function(client) {
   
    // accept the new client's connection
     application.acceptConnection(client);
    
     // send a message
     trace(client.id + " is connected");   
}

// Called when a client disconnects
application.onDisconnect = function(client) {
    trace(client.id + "disconnecting at " + new Date());
}


// Called when the client publishes
application.onPublish = function(client, livestream) {
   
    trace(livestream.name + " is publishing into application " + application.name);

    // This is an example of using the multi-point publish feature to republish
    // streams to another application instance on the local server.
    if (application.name == "publishLive/live"){

        trace("Republishing the stream into ustream");

        nc = new NetConnection();
        nc.connect( "rtmp://1.616528.fme.ustream.tv/ustreamVideo/616528" );
       
        ns = new NetStream(nc);
       
        // called when the server NetStream object has a status
        ns.onStatus = function(info) {
            trace("Stream Status: " + info.code)
            if (info.code == "NetStream.Publish.Start") {
                trace("The stream is now publishing");
            }          
        }
       
        ns.setBufferTime(2);
        ns.attach(livestream);
        ns.publish( livestream.name, "live" );
    }
}

application.onUnpublish = function( client, livestream ) {
    trace(livestream.name + " is unpublishing");
}

// RECORDING
application.onAppStart = function() {
    this.nsr = Stream.get("livestreamSS");  " <-- this is the server-side instance name
    this.nsr.play("livestream", -1, -1);          " <-- this is the published instance name

    this.nsr.onStatus = function(info){
        if(info.code == "NetStream.Play.PublishNotify"){
            application.startRecording();
        }
        if(info.code == "NetStream.Play.UnPublishNotify"){
            application.stopRecording();
        }
        for(var i in info){
            trace("i: " + i);
            trace("info: " + info);
        }
    }
}

application.startRecording = function() {
   
    var infoObject = Stream.getOnMetaData("livestream");

    trace("Metadata for myVideo.flv:");
       
    for( i in infoObject ){
        if infoObject == "record" {
            trace("start recording");
            this.nsr.record();
        }
    }
   
}

application.stopRecording = function() {
    trace("stop recording");
    this.nsr.record(false);
}

    This topic has been closed for replies.
    Correct answer

    In your FMS installation directory, look in logs/_defaultVHost_/publishLive, and see if there are any errors listed in any of the applicationXX files. If there's a syntax error in your code, it will be listed there.

    2 replies

    Correct answer
    January 13, 2010

    In your FMS installation directory, look in logs/_defaultVHost_/publishLive, and see if there are any errors listed in any of the applicationXX files. If there's a syntax error in your code, it will be listed there.

    pankersAuthor
    Participant
    January 13, 2010

    Found the syntax errors, thanks!


    January 13, 2010

    Are these two lines:

    this.nsr = Stream.get("livestreamSS");  " <-- this is the server-side instance name
        this.nsr.play("livestream", -1, -1);          " <-- this is the published instance name

    exactly as they are in your main.asc? If so, you'll need to comment out everything after the semicolon in each line... those uncommented comments would cause the app to fail to load.

    pankersAuthor
    Participant
    January 13, 2010

    that is my main.asc...if you mean in my client, then yes, here is the publish code for the client

    private function publishCamera():void {
                cam = Camera.getCamera();
                cw = cam.width;
                ch = cam.height;
                switch (cw) {
                    case 160:
                    cam.setMode(320, 180, 10);
                    break;
                    case 320:
                    cam.setMode(640, 360, 5);
                    break;
                    default:
                    cam.setMode(160, 90, 15);
                    break;
                }
                cam.setQuality(0, 0);
                mic = Microphone.getMicrophone();
                ns = new NetStream(nc);
                ns.client = this;
                ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
                ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
                ns.attachCamera(cam);
                ns.attachAudio(mic);
                ns.publish("livestream", "live");
            }

    is that what you are referring to?  Thank you for the reply.