PDA

View Full Version : Microphone detection


amandeepsiin
01-21-2009, 02:41 PM
Hi All,

I want to write a code in Flash to detect whether user's microphone is connected to system or not.

My application records from users microphone, now while recording is accidentally or intentionally user's microphone gets unplugged from system then i want to show a message to user.

Is this possible to do in flash.

I have tried many thing but didnt succeeded. Few thing what i tried are .get method, this method only returns the sound card of the system, but didnt tell you anything about microphone is connected or not.

i am attaching the FLA file which i was trying.

Thanks in advance

secondToLast
02-10-2009, 08:32 PM
im working on a very similar application, also trying to figure out what is possible. i dont see anything in the documentation that allows you to detect whether a mic is plugged in.

you can use Microphone.muted to see if they have permitted flash access to the mic, but they still may not a mic plugged in.

the closest thing is Microphone.onActivity. this event handler receives a boolean value "true" when activity is detected via the mic, "false" when the mic stops hearing or is unplugged. like so:

active_mic.onActivity = function(active:Boolean) {
trace(active);
}

ive tested this. if the mic becomes unplugged it will catch a "false". BUT it catches the same event if the mic goes silent.

it catches a true when the mic first detects sound. if no events are detected at all, your user probably does not have a mic, or it has been muted.

so i dont think theres is an ironclad way of saying "yes there is a mic plugged into the jack"... but this is as close as you're going to get.