Skip to main content
Participant
January 11, 2007
Question

Chaining live video stream

  • January 11, 2007
  • 2 replies
  • 522 views


Hello :

I have a problem of server side "Stream class" and rebublish live video stream.
In brief, I assume the live video stream can be chained between 2 or more Flash media server, the server side code is (from FMS online documents) :

application.onAppStart = function(){
trace("::: Application has started :::");
}
application.onConnect = function(client){
application.acceptConnection(client);
}
application.myRemoteConn = new NetConnection();
application.myRemoteConn.onStatus = function(info){
trace("Connection to remote server status " + info.code + "\n");
};
application.myRemoteConn.connect ("rtmp://192.128.1.264/FMS_test");
application.myStream = Stream.get("showvideo");
if (application.myStream){
application.myStream.play("showvideo1", 0, -1, false, application.myRemoteConn );
}

This server-side code is placed on a computer which ip address is 192.128.1.163 , and I want to take 192.128.1.264 as "main flash media server" , so I assumed the former computer(192.128.1.163) can "get" the live video stream published from the later computer ( 192.128.1.264), and play the stream with a different name "showvideo1", then I placed some code on a flash movie :

client_nc = new NetConnection();
client_nc.connect("rtmp://192.128.1.163/FMS_test");
client_ns = new NetStream(client_nc);
client_video.attachVideo(client_ns);
client_ns.play("showvideo1");

In theory, if the former computer(192.128.1.163) can "republish" the live video stream from 192.128.1.264, I should see the live video on this flash movie, but I didn't see anything, could anyone tell me what's wrong with my code, or I had misunderstood the concept ?
    This topic has been closed for replies.

    2 replies

    Inspiring
    January 22, 2008
    Well, you are doing everything right, except for a couple of things

    application.myStream cannot get "showvideo" from the external server, this is a local stream. You should assign an internal name for that stream (to which clients will subscribe) using the get() method, then tell this stream to play the external stream using the play() method. Its a little confusing what "showvideo" and "showvideo1" represent so I will assume:

    showvideo1 = stream playing on external FMS (192.128.1.264);
    showvideo = local stream to which clients subscribe

    so:

    //create a local stream an assign name "showvideo"
    application.myStream = Stream.get("showvideo");

    //play external stream
    application.myStream.play("showvideo1", 0, -1, false, application.myRemoteConn );

    -----Client side --------

    //subscribe to the stream "showvideo"
    client_ns.play("showvideo");
    Participant
    January 22, 2008
    Did you manage to solve your problem? I'm interested how to chain serveral flash media servers, too.