Skip to main content
Participating Frequently
September 16, 2010
Question

Republish server to server but with FCPublish

  • September 16, 2010
  • 1 reply
  • 2061 views

hi !

I would like to RePublish Live Stream to a CDN (Level3).

this CDN must use FCpublish on Client Side (like FME).

my Publisher send stream on FMS3.5 (Server1) and this stream must go to Serveur2 (CDN) with FCPulish.

On my local serveur1, i add some code to do that but whitout succes...

i can RePublish when i simulate the second Server(2) on my LocalHost BUT withOut the FCPublish Method..

(i use the sample from Adobe Flash Media Server "Publishing server 2 server")

How can i change this sample to use the FCPublish method to republish the stream to Server2 ?

with my tests, i think that my problem is how to receive the "onFCPublish = netstream.publish.start" from the server2 to my server1

please, do you have a great and simple sample (like this before) to reStream by FCPublish Method ? thank's

I know how to make it in AS3 on my Flex Client Application but not in the Action Script on the main.asc

Thank's a lot !!

    This topic has been closed for replies.

    1 reply

    Adobe Employee
    September 16, 2010

    I dont know why you want to use that but I would like to tell you that FCPublish is call made by FMLE to FMS and if you want to have this call from FMS to FMS then you need to explicitly call this method and handle it on server2 in the below manner:

    Server 1:

    // Called when the client publishes
    application.onPublish = function(client, myStream) {
        trace(myStream.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 == "livestreams/_definst_"){
            trace("Republishing the stream into livestreams/anotherinstance");
            nc = new NetConnection();
            nc.connect( "rtmp://localhost/livestreams/anotherinstance" );
            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(myStream);
            ns.publish( myStream.name, "live" );

            nc.call("FCPublish", null , myStream.name); 

            nc.onFCPublish = function(info){

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

                        trace("Publish started on server 2 for stream : " + info.description);

            }
        }
    }

    Server 2 :

    /**
    * This is to handle the legacy call from FMLE to notify
    * us when a publishing starts.  Since, we are now doing that
    * in application.onPublish, this becomes an no-op.
    */
    Client.prototype.FCPublish = function( name )
    {
    debug("Inside FCPublish - stream name: " + name);
    this.call("onFCPublish", null, {code:"NetStream.Publish.Start", description:name});
    }

    Regards,

    Amit