The following example shows how you can request access to the user’s microphone using the static Microphone.getMicrophone() method and listening for the status event.
Full code after the jump.
// ActionScript 3.0 var mic:Microphone = Microphone.getMicrophone(); mic.setLoopBack(); mic.addEventListener(StatusEvent.STATUS, mic_status); var tf:TextField = new TextField(); tf.autoSize = TextFieldAutoSize.LEFT; tf.text = "Detecting microphone..."; addChild(tf); function mic_status(evt:StatusEvent):void { tf.text = "Microphone is muted?: " + mic.muted; switch (evt.code) { case "Microphone.Unmuted": tf.appendText("\n" + "Microphone access was allowed."); break; case "Microphone.Muted": tf.appendText("\n" + "Microphone access was denied."); break; } }
{ 6 comments… read them below or add one }
Hi,
We were looking for a way to capture the mic audio data and save it to mp3
Will this really need a flash communication server!??!
Please advise
Thanks
Tamer
hi,
thanks for useful example you placed here. i am too excited in capturing sound and saving it to whatever format for now. any Idea ?
Thanks Again
Echo
I want to know microphone recording too.
Must we need FMS?
Why cant it be saved to somewhere upon finishing recording?
Hi there!
Isn’t it possible to store recorded data in byte array?
Greetings houdini
thank you this example help me in my work thanks_Egypt
Hi all,
If your interested in saving the input to the file, your will need to store it in a byte array and then output the byte array data to a file of your choose with the right encoding of the file.
Check out: http://theflashblog.com/?p=1426
Thanks,
Ant.