Detect when AVAudioSession is being "Ducked" Detect when AVAudioSession is being "Ducked" ios ios

Detect when AVAudioSession is being "Ducked"


This feature was added in iOS 9 and can be enabled by setting your audio session mode to AVAudioSessionModeSpokenAudio. Other apps that speak such as navigation apps will interrupt your audio instead of ducking.

See: https://developer.apple.com/documentation/avfoundation/avaudiosessionmodespokenaudio


I wrote to Apple DTS about this issue. Here is what I got back:

Thank you for contacting Apple Developer Technical Support (DTS). Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations.

If you would like for Apple to consider adding support in the future to allow/notify the background app to stop playing audio when the foreground app chooses to duck other audio, then enable the background app to start audio again after ducking completed, please submit an enhancement request via the Bug Reporter tool at http://bugreport.apple.com.

Seems that it's impossible right now unfortunately.


I never did this, but I imagine you could use AudioSession services C function audioSessionAddPropertyListener to register your callback for kAudioSessionProperty_OtherAudioIsPlaying.

Be aware there's some confusion in "FLATDACTED" documentation and Apple DevForums about the possibility of all or some AudioSession C functions being deprecated "in the future".