Resuming Audio at full volume immediately after Siri command

I'm working on a podcast app and I'm running into a small quirk I'd like to fix. On Apple's Podcast app and on the Spotify app when I say, for example, "Hey Siri, skip" the audio pauses, the app performs the operation, and then immediately resumes playing the audio at the previous volume without waiting for the Siri overlay to dismiss.

But my app doesn't do that. When I say "Hey Siri, skip" it pauses the audio, performs the operation, but then audio stays paused until the overlay dismisses or the audio resumes playing at a reduced volume until the overlay dismisses depending on which route I go.

What I've tried:

Stays paused until overlay dismisses:

  • AVAudioSession.setCategory(.playback, mode: .spokenAudio), setActive(true)
  • Register for AVAudioSession.interruptionNotification
  • On .began interruption capture if audio is currently playing
  • On .ended interruption: if it was playing before, call play() again

Plays at reduced volume until the overlay dismisses:

Same as above plus:

Inside MPRemoteCommandCenter.shared().skipBackwardCommand, I call seek and then:

  1. AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
  2. AVAudioSession.sharedInstance().setCategory(.playback, mode: .spokenAudio, policy: .longFormAudio, options: [])
  3. AVAudioSession.sharedInstance().setActive(true)
  4. player.play()
  5. player.rate = playbackSpeed
  6. player.volume = 1.0

AVAudioSession.interruptionNotification finally arrives with .ended + .shouldResume, at which point volume snaps to normal.

I tried that with and without setPrefersNoInterruptionsFromSystemAlerts(true) but there was no difference.

Seems like .ended only arrives when the Siri overlay dismisses, and not during Siri's active state?

While I was trying things XCode warned me that:

Ignoring setPlaybackState because application does not contain entitlement com.apple.mediaremote.set-playback-state for platform

Which, of course, I can't add b/c it's a private API. Do I need that to do what I want? Or am I missing something else?

Thanks!

Resuming Audio at full volume immediately after Siri command
 
 
Q