Open pvandrunen opened 9 years ago
@pvandrunen I'm also seeing this as well.
Yup, can confirm this is the case, and not just for this plugin. In order to turn them on, you need to register event handlers for next/previous with MPRemoteCommandCenter
, like so:
MPRemoteCommandCenter * cc = [MPRemoteCommandCenter sharedCommandCenter];
[cc.nextTrackCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
return MPRemoteCommandHandlerStatusSuccess;
}];
@dts did you add this to the viewDidLoad
or in the init
block in MainViewController.m
?
I added it to the init block and that worked.
@dts I also was wondering how difficult it would be to add the skip forward, skip backward buttons — I can add them to the init, which shows them in the controller, but I'm not sure how to capture the click event. Any ideas?
@pvandrunen and @dts DUDEs, you rule! Thanks so much.
@pvandrunen - the correct solution is to rewrite this plugin so that it uses the latest-and-greatest API from Apple (sigh), forward the events from the Obj-C side into the JS side.
@dts I'll sponsor this. Just need the right person to make it happen.
@pvandrunen - Let's talk at some point, the problem with the way that this extension works is that there is often a gap between when the media begins playing and the metadata shows up. I've been using WNYC's PlayerHater cordova extension (with some anti-crash patches by yours truly - https://github.com/yogitunes/cordova-plugin-playerhater), to make it so that the metadata stays with the song info. Their model has many drawbacks as well, I'm afraid (it crashes on android a fair amount), so I'm wondering if there is a niche for a media player plugin that handles all of these things in a more reasonable way. What is your use case?
@dts Although there are some drawbacks to this method of updating the lockscreen, it doesn't pause instantly and it momentarily flashes the path to the file in the title field, I like that I have total control of the HTML5 audio player. I wrote a custom HTML5 player which works well in both android and ios —I haven't had any crashes. I also am using the android version of this https://github.com/homerours/cordova-music-controls-plugin it's also a bit buggy. You can check out the app that I'm using this on, it's Manager Tools in the app store. Another component to consider is the background mode — on android especially the OS would kill the app playing in the background unless I use the background mode plugin to keep the app enabled.
Yeah, I'm using a background mode plugin for both. Unfortunately, lock-screen usage is a primary use case for me, and so sub-par performance really sucks. What I'm looking to create is a HTML5/cordova plugin system that gracefully degrades if cordova isn't available, but if it is it does everything that is reasonable natively if possible.
@dts @pvandrunen Did this discussion ever continue elsewhere? I am currently building a workout app with a music player and am struggling with the lock screen controls using this plugin and cordova-music-controls-plugin for Android. I had also looked at Playerhater but abandoned it after realizing how unstable it is on Android. I'd be interested to hear more about any progress you guys have made these past few months, particularly around the lock screen controls and background playback.
Hi, sorry you guys are having issues.
I came across these similar plugins the other day: https://github.com/leon/cordova-plugin-remotecommand and https://github.com/leon/cordova-plugin-nowplaying
I have limited time at the moment and I haven't tested them but perhaps there's something we can learn from them? Any volunteers want to test them and report back?
Thanks @shi11. I will try them out as soon as I can and report back. I am currently struggling with more major issues with our media playback but as soon as those are solved I'm back to testing the lock screen. Stay tuned.
Hey guys, You can see it working in the wild if you grab the Manager Tools app in whichever app store. I am using different modules for ios and android, they co-exist without much trouble. I'm running ionic with a custom written music player script. It does check the device type so that it uses the proper plugin.
For context these are the plugins I have installed, Remote controls for iOS and Music Controls for android. Background Mode keeps android playing when the user closes the app.
cc.fovea.cordova.purchase 4.0.0 "Purchase" com.rd11.remote-controls 1.0.1 "RemoteControls" cordova-plugin-backbutton 0.3.0 "Backbutton" cordova-plugin-console 1.0.3 "Console" cordova-plugin-crosswalk-webview 1.5.0 "Crosswalk WebView Engine" cordova-plugin-device 1.1.1 "Device" cordova-plugin-dialogs 1.2.0 "Notification" cordova-plugin-file 4.1.1 "File" cordova-plugin-file-transfer 1.5.0 "File Transfer" cordova-plugin-google-analytics 0.8.1 "Google Universal Analytics Plugin" cordova-plugin-inappbrowser 1.2.1 "InAppBrowser" cordova-plugin-music-controls 1.3 "MusicControls" cordova-plugin-network-information 1.1.0 "Network Information" cordova-plugin-splashscreen 3.1.0 "Splashscreen" cordova-plugin-whitelist 1.2.1 "Whitelist" cordova-plugin-x-socialsharing 5.0.10 "SocialSharing" de.appplant.cordova.plugin.background-mode 0.6.4 "BackgroundMode" ionic-plugin-keyboard 1.0.8 "Keyboard" uk.co.whiteoctober.cordova.appversion 0.1.7 "AppVersion"
Philip Van Drunen Journey Multimedia, Inc. (616) 283-2133
On Tue, Aug 30, 2016 at 10:53 AM, Marcus Forsberg notifications@github.com wrote:
Thanks @shi11 https://github.com/shi11. I will try them out as soon as I can and report back. I am currently struggling with more major issues with our media playback but as soon as those are solved I'm back to testing the lock screen. Stay tuned.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/shi11/RemoteControls/issues/20#issuecomment-243505249, or mute the thread https://github.com/notifications/unsubscribe-auth/ACBuSE3UNls14k2GraKwpUfGdAnlI_A8ks5qlGAYgaJpZM4GcF9V .
@marcusforsberg - this whole ecosystem is pretty horridly bad at the moment. Android is crash-city, iOS suffers from its own weird edge-cases (especially when the playback and the lock screen updates are different systems). I would love it if someone would put together an iOS and Android package for media playback...
@shi11 Thanks again for the suggestion, but I can't get the lock screen controls to show up at all when testing those plugins on a device running iOS 9.3.1 😞
@pvandrunen Thanks! So have you been able to get the lock screen controls to work reliably on both platforms, including on the latest versions of iOS?
@dts As would I! I'm a Cordova newbie and have no experience with iOS, so I'm unable to solve this myself, but would definitely volunteer as a tester if some was willing to put in the effort to create a complete media playback plugin once and for all. So far I've had no crash issues on Android, though, FWIW.
@marcusforsberg https://github.com/marcusforsberg - Yes, iOS currently have play/pause and it shows what's playing and artwork. I don't have controls for skip forward/back but I don't have use for them. It might be nice to see skip ahead/back 15 seconds.
Android shows play/pause and art as well. It also has the controls in the pull-down drawer thingy when you slide your finger from the top down.
Philip Van Drunen Journey Multimedia, Inc. (616) 283-2133
On Fri, Sep 2, 2016 at 6:22 AM, Marcus Forsberg notifications@github.com wrote:
@shi11 https://github.com/shi11 Thanks again for the suggestion, but I can't get the lock screen controls to show up at all when testing those plugins on a device running iOS 9.3.1 😞
@pvandrunen https://github.com/pvandrunen Thanks! So have you been able to get the lock screen controls to work reliably on both platforms, including on the latest versions of iOS?
@dts https://github.com/dts As would I! I'm a Cordova newbie and have no experience with iOS, so I'm unable to solve this myself, but would definitely volunteer as a tester if some was willing to put in the effort to create a complete media playback plugin once and for all. So far I've had no crash issues on Android, though, FWIW.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/shi11/RemoteControls/issues/20#issuecomment-244359893, or mute the thread https://github.com/notifications/unsubscribe-auth/ACBuSI7Bib4telrFWClhP60RWzdUp9naks5qmBT3gaJpZM4GcF9V .
@marcusforsberg - I don't have the time to tackle this at the moment, I would be happy to guide you through the process of creating this kind of plugin, however!
I was able to get a working lock screen using this plugin: https://www.npmjs.com/package/cordova-plugin-remotecmd-playinginfo It's not finished and was lacking next/previous buttons at first but the author happily implemented that immediately when I asked, and everything is working really well so far.
On iOS 9.1 I see that the play button is still active but the next and previous buttons are no longer displayed.