Audio in the background for Ionic / Capacitor app

Hello all,

Previously I’ve used “@ionic-native/media” to play audio, but re-architecting my app, I tried using HTML5 audio (combined with MediaSession), and it seems to have come a long way.

My main problem seems to be that iOS shuts down my app after X minutes (sometimes a short time sometimes a longer time) when playing the audio in the background.

I’ve looked at various plugins like “cordova-plugin-background-mode” etc., but people typically write “Doesn’t work anymore” and there’s a lot of conflicting information out there. Is there a Capacitor 5 compatible preferred way to make this work with HTML5, or will I have to go back to a native audio plugin?

1 Like