• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Change the active microphone in AS3

Community Beginner ,
Jun 18, 2012 Jun 18, 2012

Copy link to clipboard

Copied

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.

Using

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.

TOPICS
ActionScript

Views

836

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Jun 19, 2012 Jun 19, 2012

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

...

Votes

Translate

Translate
Community Beginner ,
Jun 19, 2012 Jun 19, 2012

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines