Skip to main content
Participant
August 6, 2009
Question

recording "failing" the first time...

  • August 6, 2009
  • 1 reply
  • 697 views

Hi everyone, I've ran into a weird error and would love some help.

currently, we're running FML 2  and I'm writing a very simple recording application that generates a random stream name and publishes a flv using the microphone on the user's computer. The error I'm running into is that the first time I press record (and run netstream.publish(fileName, "record")) it always fails.  if I stop recording, then rerecord it works fine.

an example of the code I'm using:

active_mic = Microphone.get();

active_mic.setGain(90);  

today = new Date();

fileName = "test"+today.getTime().toString();

client_nc = new NetConnection();

client_nc.connect("pathToServer");

function startRecording() {

out_ns = new NetStream(client_nc);

out_ns.onStatus = function(info) {trace("Level: " + info.level + "\n   Code: " +  info.code); }  

out_ns.attachAudio(active_mic);
out_ns.publish(fileName, "record");

}

function endRecording() {

        out_ns.close();
        out_ns.attachAudio(null);

}

like I said, it always fails when I first "record".  if I end the recording and start again it works fine.

(the trace basically reads NetStream.Record.NoAccess)

any idea?  a workaround I did was to put a publish and close immediately in the begininng to "trick" it to recording.  If this is expected then maybe its a bug?

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    August 9, 2010

    I suppose you are saying FMS 2.0. If yes then i should say it will be hard for me to repro in house - will need to search for the build and try it out.

    And even if it was bug then , i m pretty sure it would have got fixed by now. Lots of things have changed from 2.0 to 3.5.

    Also just be sure - when you click on StartRecording - you are sure your NetConnection has returned with Success