1

Is it possible to monitor changes to the Audio route without playing music? I have found this question, but it seems to rely on audio being played.

My current setup looks something like this:

NotificationCenter.default.addObserver(self, selector: #selector(routeChange), name: .AVAudioSessionRouteChange, object: nil)

@objc
func routeChange(n: Notification) {
    ...
}

The background mode "Audio, AirPlay and Picture in Picture" is enabled.

My setup seems to work fine as long as the app is in foreground. As soon as it is in the background, routeChange will not be called anymore.

Lehks
  • 2,582
  • 4
  • 19
  • 50

0 Answers0