Skip to main content
Known Participant
March 22, 2010
Answered

save streaming in different file

  • March 22, 2010
  • 1 reply
  • 1224 views

I want to record the my stream at media server with file name 1.flv, and after 30 min same stream saved in another file like 2.flv, same prcess atfetr each 30 min.

How to do that

    This topic has been closed for replies.
    Correct answer

    Do you want to do server-side record or on client side. Either ways the logic remains the same:

    You can define a timer that calls a function every 30 minutes. In that function unpublish the first stream and start publish of the second stream with the new name. Let's say

    //Pseudocode

    var streamName:string  = "1";

    var counter:Number = 1;

    var timer:Timer = new Timer(30000);

    timer.addEventListener(TimerEvent.TIMER,timeout);

    //Create new netConnection and Initialize a netstream , let's say nc is NetConnection and ns is you new NetStream;

    ........

    ........

    ........

    ns.publish(streamName,"record");

    timer.start();

    .........

    ..........

    ...........

    .........

    function timeout() {

         //Unpublish the netstream

        

         counter++;

         streamName = counter.toString();

         ns.publish(streamName,"record");

    }

    //Finally when you want to stop issue timer.stop()

    I hope this can get you started. Please revert back if you need clarifications.

    Thanks,

    Abhishek

    1 reply

    Correct answer
    March 22, 2010

    Do you want to do server-side record or on client side. Either ways the logic remains the same:

    You can define a timer that calls a function every 30 minutes. In that function unpublish the first stream and start publish of the second stream with the new name. Let's say

    //Pseudocode

    var streamName:string  = "1";

    var counter:Number = 1;

    var timer:Timer = new Timer(30000);

    timer.addEventListener(TimerEvent.TIMER,timeout);

    //Create new netConnection and Initialize a netstream , let's say nc is NetConnection and ns is you new NetStream;

    ........

    ........

    ........

    ns.publish(streamName,"record");

    timer.start();

    .........

    ..........

    ...........

    .........

    function timeout() {

         //Unpublish the netstream

        

         counter++;

         streamName = counter.toString();

         ns.publish(streamName,"record");

    }

    //Finally when you want to stop issue timer.stop()

    I hope this can get you started. Please revert back if you need clarifications.

    Thanks,

    Abhishek

    Known Participant
    March 22, 2010

    Thanx,

    How to acheive it by server side script

    Known Participant
    March 22, 2010

    I am using this code at server side please tell me how implement that

    application.onAppStart = function()
    {
      trace("The Broadcast has begun!");
    };

    application.onConnect = function(client,nameNow)
    {
      client.name=nameNow;
      application.acceptConnection(client);

      Client.prototype.recordLive = function(flvName)
            {
                  this.liveStream = Stream.get(flvName);
                  if (this.liveStream)
                  {
                       this.liveStream.play(streamName);
                       this.liveStream.record();
                  }
            }
    }

    application.onDisconnect = function(client)
    {
      trace(client.name + " has left.");
    }