homerours / cordova-music-controls-plugin

A Cordova plugin displaying music controls in notifications (cordova-plugin-music-controls)
MIT License
155 stars 186 forks source link

Music controls don't work with background mode on iphone #133

Open madmandrew opened 5 years ago

madmandrew commented 5 years ago

Using ionic 3 and deploying to iphone. When background mode is enabled music controls don't show up at all. with background mode turned off music stops on screen lock and music controls show up but don't do anything.

cordova-plugin-music-controls: 2.1.4 cordova-ios: 4.4.0 cordova-plugin-background-mode: 0.7.2

neoassyrian commented 5 years ago

Make sure you are using the UIWebView and not the new WKWebView in Ionic. (WKWebView is the default) https://ionicframework.com/docs/wkwebview/

madmandrew commented 5 years ago

Tried both options for downgrading and still didn't work

I was able to get it to work by using the ionic media plugin. This for some reason runs the audio in the background without the background mode on.

TylerAHolden commented 5 years ago

https://github.com/katzer/cordova-plugin-background-mode/pull/274/files

fixes it

khevamann commented 5 years ago

This plugin doesn't use https://github.com/katzer/cordova-plugin-background-mode though right? or am I supposed to install the plugin?

ghenry22 commented 5 years ago

The problem with the background mode plugin is that it plays a silent audio file in the background continuously to fake activity and stop suspension of the app even when it's idle. It may be fixed now but the problem was that the background-mode plugin steals the audio session.

I would recommend giving the ionic-webview plugin a look if you want background processing support as it enables background processing but doesn't fake any work load so the OS can still suspend your add as it needs to when it is idle.