2

i'm wondering if there's a way to record live audio from flash' SoundMixer (NOT from the microphone).

Might be a simple question but i'm a noob with red5/fms technologies and can't find anything online that answers my question :\

TIA for your attention.

jurito
  • 351
  • 3
  • 16

1 Answers1

2

There's a lot involved in getting this all working, but the core of the solution is to configure your Flash app to:

  1. Create a NetConnection object
  2. Create a NetStream object, passing the NetConnection to the constructor
  3. Call your NetStream object's attachAudio method, passing it an instance of whatever audio source you want to use.
  4. When you want to stop recording, simply close the NetStream object.

in code, that would look something like:

private var myMic:Microphone;
private var nc:NetConnection;
private var ns:NetStream;

// get connected
private function get_connected():void {
    nc = new NetConnection();
    nc.connect("rtmp://your.domain.tld:1935");
}


// get audio source
private function init_audio():void {
    myMic = Microphone.getMicrophone();
}

// start recording
private function start_recording(fileName:String):void {
    ns = new NetStream(nc);
    ns.attachAudio(myMic);
    ns.publish(fileName, "record");
}

// stop recording
private function stop recording():void {
    ns.play(false); // flushes the recording buffer
    ns.close();
}

I realize that's a pretty broad overview, but it's a pretty broad topic. Please comment if you have questions on the specifics.

Chris Lawlor
  • 47,306
  • 11
  • 48
  • 68