I would like the audio in my app to duck music being played in the background, but also not be played when the ringer/silent switch is switched to silent mode. I am able to get this behavior with the following AVAudioSession
configuration, with one caveat -- when music is playing and the device is silenced, it is still ducking the music, even though my app (correctly) doesn't actually play any audio.
Is there a configuration to make this work properly? It seems strange that the system would duck others when the app doesn't actually play audio. Is it possible this is a bug in iOS?
try AVAudioSession.sharedInstance().setCategory(.ambient, mode: .default, options: [.duckOthers, .interruptSpokenAudioAndMixWithOthers])
This is what I have implemented and I just muted my iPad and it plays no sound. But I am not sure if the behaviour is same on iPhone as I generally always have my phone on mute and still hear audio...