homerours / cordova-music-controls-plugin

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

Return MPRemoteCommandHandlerStatus required for iOS 13 #158

Open yoojene opened 5 years ago

yoojene commented 5 years ago

PR summary

Apple API docs state that functions with MPRemoteCommandEvent params should return MPRemoteCommandHandlerStatus.

Current implementation has these as returning void, which is crashing apps using this plugin in iOS 13.

PR returns MPRemoteCommandHandlerStatusSuccess in all actions of this type

Issue(s) related

https://github.com/homerours/cordova-music-controls-plugin/issues/157

Steps to test

  1. Call MusicControls.create({.. on iOS 13 results in app crash
  2. Update code with this PR
  3. Call MusicControls.create({.. on iOS 13 results in app not crashing
drewrygh commented 5 years ago

Thanks for putting this together. I ran into this issue as well, and can confirm that it fixes it.

fdambrosio commented 5 years ago

thank you! Will be added to the master?

JumBay commented 5 years ago

@yoojene @drewrygh as I can see, you've managed to make it works on iOS 13. Could you mind to share a working sample code? I've tried by copy/paste the example in the readme but no luck. I don't get any error, it just doesn't work. I've tried with your branch too, but again no luck.

Thanks

dupphil commented 5 years ago

@yoojene it works for me. Thanks a lot

MarcelvanGastel commented 5 years ago

Yes! It works! Thanks a lot!

fdambrosio commented 5 years ago

@JumBay you can use git+https://github.com/homerours/cordova-music-controls-plugin.git#90e3fe8838c3151bd8e51901079eb34740ec87c9

jerodfritz commented 5 years ago

I can confirm this fixes the crashing on iOS13 in my Ionic app by doing the following:

ionic cordova plugin remove cordova-plugin-music-controls
ionic cordova plugin add git+https://github.com/homerours/cordova-music-controls-plugin.git#90e3fe8838c3151bd8e51901079eb34740ec87c9ionic
JumBay commented 5 years ago

@fdambrosio I've managed to make it works. I'm using this plugin to control a remote player. I didn't know the device has to play something to make it works (on iOS).

tbergeron commented 5 years ago

Is this project dead? Does anybody maintain it? Will this get merged in the foreseeable future?

JumBay commented 5 years ago

@tbergeron yes, see the readme.

Does anyone manage to make the callbacks work on the create method? it seems to be never called

yoojene commented 5 years ago

Noticed this PR was suddenly not working , have added MPRemoteCommendHandlerStatus return values for skipForwards and skipBackwards actions

For anyone still trying, after commit 75179c8 the plugin works for me on iOS 13.1.2