I wonder if there is any way to disable microphone programmatically (to get rid of the red bar in the background)?
I use OpenEars to listen for commands in the app. When I go to the background red bar appears (which is obvious, as microphone is active).
The problem is that the microphone is active even when OpenEars is suspended. To avoid unnecessary questions I cannot stop OpenEars as it ends up with mixing audioSession with my other sources.
The "red bar" will never disappear, even when the microphone is not in use by your application unless you explicitly stop the audio session. This is a security measure Apple has put in place to alert users of your application that it is listening to their microphone, even if you aren't doing anything with the microphone data at that exact moment.
If you are using
AUAudioUnit, you may have some luck settingisInputEnabledtofalse.