androidiosprogressive-web-appsbackground-audio

PWA play media in background


I have an idea to build a simple mobile website that can play music when minimized or even when the phone is locked. I know support for this is limited, so was wondering, is a PWA a solution for this? I can’t find much documentation about the support of a PWA play media in the background. So does anyone know if this is even possible on Android and iOS, or where i can find more info about this?

Thanks in advance!


Solution

  • In Safari on iOS, the audio will pause if (A) the screensaver kicks in, (B) the app is minimized, or (C) the user temporarily switches to another app. To mitigate the problem in this particular use case, you might need to wrap the app in Cordova, and combine Cordova with a plugin, such as this one: https://thecodebeast.com/post/cordova-allow-audio-to-play-in-background-and-in-silent-switch/72