Open stevesobol opened 5 years ago
Does the app stop playing or the background music?
This plugin only ensures that background music can play over the app. It doesn’t change how sounds play in the app. The issue may be your sound library. What are you using?
HTML5
And I'm not sure what the answer to the first question is.
If the problem is indeed that the app is stopping, is there a way to prevent that from happening in Cordova? I'm already using the Insomnia plugin and it works perfectly on Android.
What the plugin does is change the iOS value that stops background music from playing from other sources while your app is active. It does not alter what your app actually plays.
Cordova provides a resume event in the document.addEventListener('resume', handler). You can use this to reactivate playing music or sounds. Here's the documentation: https://cordova.apache.org/docs/en/latest/cordova/events/events.html
Try re-initializing the sounds on the resume event.
I must be missing something. Will that allow the audio to keep playing when I send the app to the background? Clarify, please...?
Ah. You have the wrong plugin. This plugin provides the opposite functionality: it allows background music to play even when the app has its own sounds. Normally an app with sound will halt any background music.
despite the use of the plugin...
After observing that it didn't work, and Googling around a bit, I also turned on the following Background Modes: Audio, AirPlay and Picture-in-Picture and (as suggested by one or two people) Voice Over IP.
No love. :(