Skip to main content
Robert Mc Dowell
Legend
December 21, 2010
Question

Stream.play(false) error

  • December 21, 2010
  • 3 replies
  • 1638 views

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 has been closed for replies.

    3 replies

    Robert Mc Dowell
    Legend
    December 22, 2010

    Stream.destroy(Stream) works but I get always

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

    I'm stucked....

    Participating Frequently
    December 23, 2010

    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.

    Robert Mc Dowell
    Legend
    January 9, 2011

    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

    Participating Frequently
    December 22, 2010

    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.


    Robert Mc Dowell
    Legend
    December 21, 2010

    .. in a component server side script of course


    Participating Frequently
    December 22, 2010

    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!!!");
    }
    Robert Mc Dowell
    Legend
    December 22, 2010

    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