6

Each time I stop/pause the audio engine (using AVAudioEngines stop() or pause()), a red mic icon appears on the status bar for a second.

This starts to be annoying after a while, something red appearing at the top each time I pause/stop the engine.

This happens in iOS 13, when enabling audio background mode capability.

enter image description here

To reproduce this, create a new single view project, and add this to the view controller:

private let engine = AVAudioEngine()

And in the viewDidAppear:

engine.connect(
   engine.inputNode, 
   to: engine.mainMixerNode, 
   format: engine.inputNode.inputFormat(forBus: 0)
)
try? engine.start()

DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
   self.engine.pause() // or self.engine.stop()
}

Remember to enable audio background mode, to add NSMicrophoneUsageDescription in the Info.plist, and run it in a iOS 13 device. Accept mic permission and re run the app. You will see the red mic icon flashing one time.

Is there a way to get rid of this?

ernewston
  • 633
  • 4
  • 14

0 Answers0