search

Home  >  Q&A  >  body text

In ionic capacitor IOS, play audio in background without stopping other apps from playing

In my Angular Ion Capacitor app, On IOS, when I have Spotify music playing in the background and then my quiz app makes a sound, the Spotify music stops playing.

Both of these situations will happen:

HTMLAudioElement https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement

and Capacitor Community/Native Audio (source: https://github.com/Capacitor Community/Native Audio/issues/40)

Can anyone solve this problem?

Note: It works on Android

P粉555696738P粉555696738243 days ago421

reply all(1)I'll reply

  • P粉203648742

    P粉2036487422024-03-22 13:47:17

    I just solved this problem myself using this package: https://github.com/Cap-go/native-audio

    This fork is ahead of the packages you mentioned and is capable of mixing audio. Check out the fade and focus options mentioned in the readme.

    reply
    0
  • Cancelreply