Skip to main content
Participating Frequently
March 21, 2011
Question

Pulling a stream from external FMS and publishing in Multicast

  • March 21, 2011
  • 1 reply
  • 903 views

Hi. I'm developping a FMS 4 application that read an external stream, and then, republish it in multicast:

1.- So, first of all I open  a NetConnection to the remote application. And I associate it to a new Stream created in the application. Then I have the stream available in my application.

nc = new NetConnection();

nc.connect(REMOTE_APPLICATION);

nc.onStatus = function(info)

{

trace("REMOTE_APPLICATION->NetConnection> code: " + info.code);

if (info.code == "NetConnection.Connect.Success")

{

  rebroadcast_s = new Stream.get("tempStream");

  rebroadcast_s.onStatus = function(info)

  {

   trace("Stream> code: " + info.code);

   trace("Stream> details: " + info.details);

   if (info.code == "NetStream.Publish.Start")

   {

          trace("REMOTE_STREAM->The stream is now publishing");

  }

  };

  rebroadcast_s.play(REMOTE_STREAM, -1, -1, true, nc);

}

};

2.- I would like to use the same methods of native multicast.as application, for managing the multicast publishing: registerStream, openMulticastConnection, ...

var MULTICAST_PARAMETERS = "fms.multicast.type=2&fms.multicast.groupspec=G%3A0101210558cc3408e77326e2fa1c53c52697d73e1b02182c358c57075cd9a58ed1a25241010d160e666d732e6d756c7469636173742e6578616d706c65210e8555a813f0c73cd8f5384e0fba657163ab87e76c25b6f82be9b94777b2d52cfe00070aefff00fe7530051576706f64&fms.multicast.address=239.255.0.254%3A30000";

var params = parseQueryString(MULTICAST_PARAMETERS);

var streamContext = registerStream(CLIENT??????, MULTICAST_STREAM_NAME, params);

openMulticastConnection(streamContext);

But, I don't know who would be the client in the registerStream method. Which reference should I add there? Is it possible in this way?

I made another different script that republish that stream in localhost using NetConnection.publish(localhost/sameapplication). It works properly. But I would like to be able of managing it in the other way.

Thank you,

Iván

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    March 22, 2011

    Even i am not sure about this - how it should work or whether it would work or not. What happens if you give client as NULL or say nc object which you are using to remote play?

    ivangetaAuthor
    Participating Frequently
    March 22, 2011

    1.- Tried adding NULL, and there's an error trying to access to the properties of the parameter, and finally the multicast publication is not done:

    Registered multicast context for source stream: livestream

    Sending error message: /opt/adobe/fms/applications/vpodmulticast2/main.asc: line 308: TypeError: streamContext.client has no properties

    2.- Tried adding the nc reference, and there's no error in the logs, but the multicast publication is not done neither.

    3.- Going deeply in the code, I discovered that client object is only used for getting the client.uri (the uri where the client is publishing the stream) and the client.ip (for internal connection managing). So I created a client object with these two attributes, and It's working properly:

    var params = parseQueryString(MULTICAST_PARAMETERS);

    var client = new Object();

    client.uri = "rtmp://localhost/"+application.name;

    client.ip = "localhost";

    var streamContext = registerStream(client, MULTICAST_STREAM_NAME, params);

    openMulticastConnection(streamContext);

    Thank you,

    Iván