Unable to call onFCPublish method
hi,
i trying develop server-side application(splitterapp) using fms 3.5.2 accept incoming stream 3rd party encoders , publish the stream using fcpublish method application(edgeapp) on our edge servers. splitterapp contains 3 classes performing activity. whenever incoming stream received splitterapp, the main.asc create object of type incomingstream() , push unpublished array. timer based job picks unpublished stream array , invokes streamcontroller.publishstream(). streamcontroller.publishstream() method creates new publishedstream() initialised incoming stream. method thereafter calls publishedstream.publishstream() initiate net connection edge server application(edgeapp). after successful net connection, call "this.publish_connection.call ("fcpublish", null,this.thisstream.stream.name)".
the edgeapp accepts publish , therefore performs:
client.call ("onfcpublish", null,
{
code : "netstream.publish.start", description : name
});
so when call reaches splitterapp, error stating "sending error message: method not found (onfcpublish)."
any or suggestion appreciated.
/************ streamcontroller.asc*************/
streamcontroller = function ()
{
//initialisation
trace ("streamcontroller initialized");
this._publishedstreams = new array ();
}
streamcontroller.prototype.publishstream = function (stream)
{
trace ("streamcontroller.publishstream received new stream: " + stream.name);
var newstream = new ingressstream (stream);
newstream.publishstream ();
this._publishedstreams.push(newstream);
}
/***************end of streamcontroller.asc**************/
/*************** publishedstream.asc**************/
var publish_connection = new netconnection ();
var publish_netstream;
var fms_pub_url = "rtmp://xxxxxx/xxxxxxxx";
var thisstream;
publishedstream = function (incomingstream)
{
this.thisstream = incomingstream;
trace ("publishedstream.initialised incoming stream " + incomingstream.stream.name);
}
publishedstream.prototype.publishstream = function ()
{
trace ("publishedstream.publishstream incoming stream " + this.thisstream.stream.name);
this.publish_connection = new netconnection ();
this.publish_connection.client = this;
var thisobject = this;
this.publish_connection.onstatus = function (info)
{
thisobject.onstatus(info);
}
publish_connection.connect (fms_pub_url);
}
publishedstream.prototype.onstatus= function (e)
{
trace ("publishedstream.onstatus:" + e.code);
if (e.code == "netconnection.connect.success")
{
this.publish_connection.client = this;
var thisobject = this;
this.publish_connection.client.onfcpublish = function(info)
{
thisobject.onfcpublish(info);
}
this.publish_connection.call ("fcpublish", null,this.thisstream.stream.name);
}
}
publishedstream.prototype.onfcpublish = function (info)
{
trace ("publishedstream.onfcpublish:" + info.code);
if (info.code == "netstream.publish.start")
{
this.publish_netstream = new netstream (this.publish_connection);
this.publish_netstream.setbuffertime (2);
this.publish_netstream.attach (this.thisstream.stream.name);
this.publish_netstream.publish (this.thisstream.stream.name, "live");
this.publish_netstream.onstatus = function (infoobject)
{
var eventcode = infoobject.code;
}
}
}
/**************************************end of publishedstream.asc*******************************/
/**************************************incomingstream.asc********************************* ***/
incomingstream = function (newclient , newstream)
{
this.client = newclient;
this.stream = newstream;
this.name = this.stream.name;
}
incomingstream.prototype.tostring = function ()
{
var tostring = this.stream.name + " " +this.client.ip;
return tostring;
}
/***************end of incomingstream.asc****************/
/********************main.asc of edge server application***********/
application.onconnect = function (newclient )
{
var thisclient = newclient;
//clients send fcpublish ask premission publish stream
newclient.fcpublish = function (name )
{
trace ("inside newclient.fcpublish name: " + name);
if (some condition)
{
//the stream published client
this.call ("onfcpublish", null,
{
code : "netstream.publish.badname", description : name
});
}
else
{
application.acceptpublish (name, thisclient );
}
}
return true;
}
application.acceptpublish = function (name, client )
{
trace ("main:application.acceptpublish: started " + name);
client.call ("onfcpublish", null,
{
code : "netstream.publish.start", description : name
});
}
/*************end of main.asc of edge server application*****************/
snippet splitterapp log file:
2010-09-02 14:20:35 6724 (s)2641173 streamcontroller.publishstream received new stream: dev_stream -
2010-09-02 14:20:35 6724 (s)2641173 publishedstream.initialised incoming stream dev_stream -
2010-09-02 14:20:35 6724 (s)2641173 publishedstream.publishstream incoming stream dev_stream -
2010-09-02 14:20:35 6724 (s)2641173 ingressstream.onstatus incoming stream dev_stream -
2010-09-02 14:20:35 6724 (e)2641277 sending error message: method not found (onfcpublish). -
snippet edgeapp log file:
2010-09-02 14:20:35 6724 (s)2641173 inside newclient.fcpublish name: dev_stream -
2010-09-02 14:20:35 6724 (s)2641173 stream doesnot exists stream: dev_stream -
2010-09-02 14:20:35 6724 (s)2641173 main:application.acceptpublish: started dev_stream -
thanks in advance,
i did not go through detail , not sure trying , how trying them out.
but on thought can change line : this.publish_connection.client.onfcpublish "this.publish_connection.onfcpublish " , see if takes care of error. server-side code as1 , way coded more as3 - don't know how should pan out.
More discussions in Adobe Media Server
adobe
Comments
Post a Comment