Status bar shows mic icon for a moment when pausing/stopping AVAudioEngine in iOS 13
Asked Answered
E

0

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?

Embank answered 2/10, 2019 at 2:17 Comment(3)
Hi, I am having the same issue in iOS 14. Were you able to find solution?Winton
Did you find a solution? I am experiencing the same issue.Geoponic
Nope. Sorry, we just let it happen :/Embank

© 2022 - 2024 — McMap. All rights reserved.