views:

557

answers:

3

Hi guys, I'm having a few problems detecting whether a microphone is detected or not. I'm running the function Microphone.getMicrophone() and that should return null if there is no microphone attached, or if the user has clicked Deny on the security panel, right?

The problem I'm facing is, on some computers where there is no microphone installed, Microphone.getMicrophone() still traces out as [object Microphone].

So say for example the user doesn't have a microphone, and clicks allow in the security panel, I can't validate whether to switch to different controls.

If anybody can shed some light on how to detect if there is no microphone connected, then I'm all ears.

Many thanks in advance, Will

+1  A: 

Well, i would recommend to make mic test upon connection, record 1-2 seconds from user and send it back to server for evaluation, send it back to user and make some button for user to approve if he heard the sound. This is what Skype do, you can add some fancy controllers to have proper noise threshold level and in/out volume and such on the same test screen.

I'm not sure but even if getMicrophone() returns false/non existent device it cannot record it properly anyway.

eugeneK
A: 

you can check the mic.activityLevel property to check if there is any mic level

also, if the computer has multiple mics, you can iterate amic in flash.media.Microphone.names to check each level.

jujule
A: 

I would advise to check flash.media.Microphone.names and see if it is empty.

Michael Pliskin