Search code examples
flashactionscript-3apachevideo-streamingflash-media-server

How to make a video stream published with FMS available from 2 different urls (on the same domain)


I'm publishing a multibitrate stream with adobe live media encoder to flash media server and i have to duplicate it to two different urls within one domain. Maybe it's possible by configuring apache or maybe there's another way. Any help'd be appreciated. Thx in advance.


Solution

  • If anyone needs this info:
    * create a folder in Flash Media Server 4\applications (i called it 1) and copy all files from Flash Media Server 4\applications\live there.
    * in Flash Media Server 4\applications\live\main.asc (if there's no such file - copy one from Flash Media Server 4\samples\applications\live) add the following code:
    + to application.onAppStart = function():

    conn = new NetConnection();
    conn.connect("rtmp://server_ip/1");//ip/new application folder name
    


    application.onPublish = function (clientObj, streamObj){
        trace("got a stream : " + streamObj.name);
        if(conn.isConnected){
            ns = new NetStream(conn);
            ns.attach(streamObj);
            ns.publish(streamObj.name);
            trace("publishing through other app");
        }else{
            trace("connection not ready");
        }
    }