1 Reply Latest reply on Jun 19, 2012 9:50 AM by Smilinfoo

    Change the active microphone in AS3


      Is there a way to change the active microphone in AS3 without using the SecurityPanel.MICROPHONE?  All of my attempts stop all microphone activity, even if triggered by a button click.



      var mic:Microphone = Microphone.getMicrophone();

      works fine, them if at a later point I do

      mic = Microphone.getMicrophone(newIndex);

      and poll mic.activityLevel - the level is always -1.


      If I switch back to the original mic, it works again, which ever was originally selected in the security panel works.  This is with two working mics, and I have switched which is selected via the security panel to make sure it is not mic specific.


      Is this  a security risk and not allowed?  Once you initialize one mic, is that what you are stuck with?  I have switched cameras in air, but that was air.


      - as a side note, the reason for needing this is we get feedback whenever a user is using the computer speakers and is on firefox.  I have set loopback to false and I have brought the SoundMixer level down to 0, but as soon as the security panel microphone window pops up, the level comes up and loopback acts as if it was set to true.  When the window closes, I get control again.

        • 1. Re: Change the active microphone in AS3
          Smilinfoo Level 1

          Figured it out.  It looks as though the Microphone.activityLevel is -1 until you add a SampleDataEvent listener.  You do not need to add this if you are streaming to the server.  In my tests I was updating my reference to the mic for checking the activityLevel in an update loop.  I did not update the SampleDataEvent lsitenre since I was not actaully recording, just checking the mic input level, and did not think it needed tobe in place.

          It seams possible that the Microphone checks that it either has a SampleDataEvent listener, or is connected to a server before updating activityLevel, I just have never seen that kind of thing done.


          I am not certain this is the case, but it is what it looks  like.  If anyone has more infomation, please share.