Skip to main content
Participant
April 18, 2006
Question

Chaining streams between 2 media server

  • April 18, 2006
  • 2 replies
  • 331 views
Hi i'm trying to setup a stream chaining between 2 flash media servers.

Basically I have an swf that streams my camera to FS Server 1. In FS Server 1, i have the following code in the main.asc


application.onConnect = function(client, username){
gFrameworkFC.getClientGlobals(client).username = username;
application.acceptConnection(client);
}

application.onConnectAccept = function(client, username){
application.myRemoteConn.connect("rtmp://10.0.0.23/myapp"); // Connect to FS2
application.myRemoteConn.onStatus = function(info){
if (info.code == "NetConnection.Connect.Success" && application.myRemoteConn.isConnected){
application.myStream = Stream.get("foo");
if (application.myStream) {
application.myStream.play("me_live", 0, -1, true, application.myRemoteConn);
}
}
}
}

The stream is created in FS1, and I can view it if I connect to it with an SWF client. On the FS2 server (the server FS1 does a NetConnection to), I can see a client connection in the Clients tab but thats about it. If I try to connect to the FS2 server, there is no stream displaying on the SWF client. (The SWF client just contains a Video object which connects to the FS stream.)

Any ideas please? This may sound like a silly question, but I'm fairly new to server side action script.

Does any one have any sample code? Is there an alternate method of chaining a stream? I've thoroughly searched the docos but no luck.

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

    2 replies

    April 18, 2006
    What you want to do is have FC2 subscribe to the stream on FC1. Let's have a look at your SSAS for the app on FC2.
    Participant
    April 18, 2006
    hi jay,

    Thanks for your prompt reply. Yes I was actually trying that method aswell, obviously incorrectly. My AS code on the FS2 was this:

    application.onAppStart = function(){
    trace("application start called. create server side connection");
    application.remConn = new NetConnection();
    application.remConn.connect("rtmp://10.0.0.77/myapp"); // this connects to the FS1 server where a stream
    // called me_live is being published
    application.remConn.onStatus = function (info) {
    trace("info is "+info.code);
    }
    application.myStream = Stream.get("me_live"); // this stream is being streamed by the SWF client with a camera.
    // the stream is correctly being published. i could view this with
    // another SWF client that just retrieves the video
    if (application.myStream){
    trace("playing stream");
    application.myStream.play("me_live", -1, -1, false, application.remConn);
    }
    }


    I know that theres quite a number of errors on the above code. I would've figured though that the the Stream class has a method to retrieve a remote stream, or even in the NetConnection object (something like application.remConn.Stream.get("streamname")) - but of course it can't be that easy!! Is there way of doing this? Thanks again for your help.