Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 201
cumul Avatar asked Dec 01 '18 10:12

cumul


1 Answers

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

like image 65
vrtjason Avatar answered Sep 28 '22 13:09

vrtjason