title: How to interrupt device audio to play a sound and then let the device audio continue on iOS
body: <p>I have an app where the user can play voice messages received from other users. Playing the voice messages should interrupt device audio (music, podcast, etc playing from other apps), play the voice messages and then let the device audio continue.</p>
  <p>Here is a use specific use case I am trying to achieve</p>
  <ul>
  <li>the user starts playing music on the device via Apple Music</li>
  <li>the user opens the app and taps a voice message</li>
  <li>the Apple Music stops</li>
  <li>voice message in the app plays</li>
  <li>Apple Music continues playing</li>
  </ul>
  <p>With setting <code>AVAudioSession</code>s category to <code>.ambient</code> I can play the voice message &quot;over&quot; the playing Apple Music, but that is not what I need exactly.</p>
  <p>If I use the <code>.playback</code> category that makes the Apple Music stop, plays the voice message in the app but Apple Music does not continue playing afterwards.</p>