Skip to main content
Participant
March 4, 2013
Question

Hi I want to broadcast recorded video using flash encoder?

  • March 4, 2013
  • 1 reply
  • 3494 views

Hi I want to broadcast recorded video using flash encoder, or their is any other way for broadcating recorded media files as live tv?

This topic has been closed for replies.

1 reply

March 5, 2013

Hi,

You can do server side play of the recorded media file. After that once any one connects to that application, that file will be played as live. Following is the code to do this:

var streamname="stream_name.flv"; //Name of the recorded media file

application.onAppStart=function(){

          application.onNCA();

}

 

application.onConnect=function(clientObj){

          application.acceptConnection(clientObj);

          trace("***Connected : "+isConnected);

}

application.onNCA=function(){

          trace("onCA "+streamname);

          streamObj=Stream.get("foo");  // foo will be the live stream name

                    streamObj.onStatus = onStreamStatus;

                    trace("here "+streamname.split(".")[1]);

                    switch(streamname.split(".")[1]){

                              case "mp4":

                              case "3gp":

                              case "f4v":

                                        streamPlayName="mp4:"+streamname;

                                        break;

                              case "mp3":

                                        streamPlayName="mp3:"+streamname.split(".")[0];

                                        break;

                              case "flv":

                                        streamPlayName=streamname.split(".")[0];

                                        break;

                    }

                    trace(streamPlayName);

                    streamObj.play(streamPlayName);

}

function onStreamStatus(info){

          trace("Stream "+info.code);

}

 

application.onDisconnect=function(clientObj){

          application.shutdown();

}

Anyone connecting to above app will be able to play "foo" as livestream name.