There's a lot involved in getting this all working, but the core of the solution is to configure your Flash app to:
- Create a
NetConnection
object
- Create a
NetStream
object, passing the NetConnection
to the constructor
- Call your
NetStream
object's attachAudio
method, passing it an instance of whatever audio source you want to use.
- 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.