Skip to main content
Known Participant
March 5, 2010
Question

microphone detection

  • March 5, 2010
  • 1 reply
  • 401 views

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 mic.getMicrophone method, this method only returns the sound card of the system, but didnt tell you anything about microphone is connected or not.

    This topic has been closed for replies.

    1 reply

    calmchessplayer
    Inspiring
    March 5, 2010

    you might make this work by saying if it drops to zero for a specific amount of seconds then the mic doesn't have activity but if it stays above zero then it  has activity something like

    var micAct = Math.floor(mic0.activityLevel);

    var time0:Timer=new Timer(3000,1);

    time0.addEventListener(TimerEvent,timer);

    if(micAct ==0){

    start time0();

    }

    if(micAct >0){

    stop time0();

    }

    function timer (e:TimerEvent):void{

    //send message if timer executes

    }