Skip to main content
Robert Mc Dowell
Legend
Dec 21, 2010 1:21 AM UTC
Question

Stream.play(false) error

when I try this :

s = Stream.get("foo");

s.play("myStream",-1,-1,false,remoteNetConnection);


and stop and delete the stream

s.play(false);

delete s;

I get this error

Sending error message: Response object not found (_error:0).

is it a Scope issue ? if yes, I tried all without success.

I use this in a compoment

thanks

    This topic is closed to new replies. Start a new post to keep the conversation going.

    7 replies

    Robert Mc Dowell
    Legend
    Dec 22, 2010 6:23 PM UTC

    Stream.destroy(Stream) works but I get always

    Sending error message: Response object not found (_result:0).

    I'm stucked....

    Translate
    Participating Frequently
    Dec 23, 2010 6:10 AM UTC

    What platform and FMS version you are using?

    It would be great if you can pass me the code snippet where you are observing problem so that I can try to reproduce your issue at my side.

    Translate
    Robert Mc Dowell
    Legend
    Jan 9, 2011 4:00 PM UTC

    Linux Fedora 10 64bits

    FMS 4.0.1

    I have normal code in my main.asc

    load("mycomponent.asc");
    // load the  remoting classes
    load("netservices.asc");

    application.onConnect =  function(pClient, pPassword, pProtocol, hostURL) {
             //trace(pClient.id+" is connected ");
            if(pPassword ==  "********")
            {       pClient.appPass = pPassword;
                     pClient.protocol = pProtocol;
                    pClient.hostURL =  hostURL;
            }else{
                    var vError = new  Object();
                    vError.message = "server off";
                     application.rejectConnection(pClient, vError);
             }
    }
    etc....

    in scriptlib/components/mycomponent.asc  :

    ....

        myComponent.prototype.connect =  function(client){
                    this.client = client;
                     this.client.nc = new NetConnection();
        }

         myComponent.prototype.AA = function(client){
                                     this.client.ncURI = 
    "rtmp://remoteHost:61935/myApp";
                                     this.client.nc.objectEncoding = 0;
                                     this.client.nc.refThis = this;
                                     this.client.nc.onStatus =  function(info){
                                                 this.refThis.client.remoteStream
    =  Stream.get("remoteStream");
                                                 this.refThis.client.remoteStream.play("remoteStream",-1,
    -1, 0,  this);
                                    }
         }

          myComponent.prototype.BB = function(client){
                          if(this.client.remoteStream){
                                   this.client.remoteStream.play(false);
                                   Stream.destroy(this.client.remoteStream);
                         }
               return true;
         };
    ....

    so this.client.remoteStream.play(false)  AND
    Stream.destroy(this.client.remoteStream)
    generate in log
    Sending  error message: Response object not found (_result:0).

    thanks for your  help

    Carl

    Translate
    Participating Frequently
    Dec 22, 2010 7:07 AM UTC

    Please note that this functionality is available from FMS 3.5.3.854 build. If you are using some old version then its time

    to upgrade.


    Translate
    Robert Mc Dowell
    Legend
    Dec 21, 2010 1:22 AM UTC

    .. in a component server side script of course


    Translate
    Participating Frequently
    Dec 22, 2010 7:06 AM UTC

    Hi,

    I dont think using "delete s;" in server-side ActionScript is correct way to destroy a stream.

    You need to use the Stream.destroy(streamobject) to destroy a stream.

    Fortunately, I have a script that uses this functionality, you can take help from this one as copied below:

    =====================================================

    var x = null;
    var i = 0;
    var s1;

    application.onConnect = function(client)
    {
      application.acceptConnection(client);
      trace(client.id);
     
    }


    function s()
    {
      i = i+1;
      if (i<=10)
      {trace("hello");}
      else
      {
        trace("time up!!");
        clearInterval(x);
        Stream.destroy(s1);
       }
    }


    application.onPublish = function(myClient,myStream){
      trace( "client with client id = " + myClient.id + " is publishing stream with streamname .."+myStream.name);
      s1 = Stream.get(myStream.name);
     
      if(s1)
      {
        x = setInterval(s,1000);
        s1.onStatus = function(info)
        {
          trace("mystream onstatus:"+ info.code);
        }
      }
      s1.record();
    }

    application.onUnpublish = function(clientObj,streamObj){
    s1.record(false);
    trace("finished!!!");
    }
    Translate
    Robert Mc Dowell
    Legend
    Dec 22, 2010 3:34 PM UTC

    Hi,

    thanks for your answer.

    "delete s" is in FMS 4 documentation.

    also I just learnt that FMS 4.0.1 implemented Stream.destroy().

    Thanks

    Translate