Skip to main content
mrweb2010
Known Participant
August 30, 2011
Question

record videos with new names by AS3

  • August 30, 2011
  • 1 reply
  • 1429 views

Hello,

I'm using Flash AS3 to stream and record videos on my RTMP server, I'm suing this command

ns.publish("mystream", "record");

The  problem happenes when the connection is down for any reason and the  stream stops. My flash App start streaming automatically , but it over  right the previous video coz they have the same name, I want to change  the recorded video name "ex:myvideo1.flv" without changing the stream publishing name  "mystream".

Thanks

    This topic has been closed for replies.

    1 reply

    calmchessplayer
    Inspiring
    August 30, 2011

    well on the server side to use the following code to change the .flv name you can probably slim this down i just use the interval so that my entire script has time to run before the name is changed I store the number that I'm incrementing the file name with in a persistant remote shared object this is simpler than using a database to remember.This way I'm less likely to ever start over with file names.

    Application.prototype.StopRec1 = function(adName){
    this.recordStream = Stream.get(adName);
    this.recordStream.record(false);
    int1 = setInterval(pause1,3000,adName);

    }


    function pause1(adName){
    var zz = application.so0.getProperty("slot0");
    if(zz == null){
      zz = -1;
    }
    zz++;
    application.so0.setProperty("slot0",zz);
    trace(adName);
      fileObject1 = new File("streams/"+adName+"_rec/"+adName+".flv");
      fileObject1.renameTo(adName+zz+".flv");
    clearInterval(int1);
    //delete this.recordStream;

    }

    mrweb2010
    mrweb2010Author
    Known Participant
    August 31, 2011

    Thanks a lot. But I cannot do this from the client side,can I?

    calmchessplayer
    Inspiring
    August 31, 2011

    well you can if you want to change the "publishing stream name" I've done it both ways.