leon / cordova-plugin-nowplaying

Cordova Plugin Now Playing for iOS
28 stars 8 forks source link

Issues on Device #3

Open johnthepink opened 8 years ago

johnthepink commented 8 years ago

Hey! Thanks for the great plugin. I wonder if you can point me in the right direction.

I have created a simple cordova project that implements this plugin here: https://github.com/johnthepink/testnowplaying

I use NowPlaying to set some data here: https://github.com/johnthepink/testnowplaying/blob/master/www/js/index.js#L37-L41

This works great in the simulator:

screenshot 2016-06-23 10 48 25

But when I run the same project on my device, it doesn't seem to work:

img_7455

Do you have any ideas on why this would happen? I installed the plugin from the latest source on github. And, I tried linking MediaPlayer.framework.

Thanks!

HrBayat commented 8 years ago

Thanks for the plugin. I have the same problem too. I use it on a ionic project with cordova-media-player. Please help. Thanks.

johnthepink commented 8 years ago

@HrBayat are you using the WKWebview, or the standard WebView? Did you manage to get this working?

ghost commented 8 years ago

I ran into the same problem.

holospeed commented 8 years ago

In the MNowPlaying.m file after this: NSMutableDictionary *mediaDict = (center.nowPlayingInfo != nil) ? [[NSMutableDictionary alloc] initWithDictionary: center.nowPlayingInfo] : [NSMutableDictionary dictionary];

add this new line : [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];

photo_0162471258wylpaz

Haven't tested on simulator just on iPhone width media plugin (cordoba-plugin-media).

I suggest this settings as well:

grx6h

If you like the plugin please don't forget to donate leon who made it :) buy a coffee to him :D

marban commented 8 years ago

Interestingly enough @holospeed 's fix worked on Ionic 2 from about a week ago but stopped as of this current release. Any news on this issue?

daniavram commented 8 years ago

trying with cordova v 6.3.1. not working unfortunately. any hints? did anyone else encounter these problems lately?

EDIT: I think it may be because of iOS 10. @leon is there any chance that the plugin should be update for iOS 10?

clnhll commented 8 years ago

What's weird is this was working (if a little finicky) on the iOS 10 betas. Works perfectly in simulator, works not at all on the device.

holospeed commented 8 years ago

I made a working example. I hope it will help :) tested on iPhone 6s. https://github.com/holospeed/nowplaying

vespino commented 8 years ago

Which version of iOS did you test because in iOS10 the plugin doesn't do what it is supposed to do I'm afraid. Or the following must be wrong:

NowPlaying.set({
    artwork: logo,
    albumTitle: nice_name,
    artist: nice_name,
    composer: nice_name,
    genre: 'Hardstyle'
});

Of course the values are set. I have tried different plugins that promise to work, but don't :(

daniavram commented 8 years ago

@vespino you can try this one: https://www.npmjs.com/package/cordova-plugin-remotecmd-playinginfo. it works on the simulator, but not on the actual device, though :( if you find a way to make it work (this one or any other one), please let me know also :D

vespino commented 8 years ago

@daniavram if it doesn't work on an actual device, why would I try it?

marban commented 8 years ago

@holospeed That doesn't seem to work on iOS 10/10.1 still.

clnhll commented 8 years ago

I think if you're using WKWebView (which is now standard practice in cordova-ios >= 4.0?) you're not going to be able to override the lock screen Now Playing Info while html5 audio is playing in WKWebView. Maybe switch to cordova-media instead of HTML5 audio if possible

marban commented 8 years ago

@clnhll Don't think so. I'm using cordova-media and as mentioned above it does indeed work in the emulator but not on-device.

clnhll commented 8 years ago

Is using UIWebView an option?

vespino commented 8 years ago

@clnhll tried UIWebView, atleast I removed "cordova-plugin-wkwebview-engine" from my project, did not work.

erikpolder commented 7 years ago

It works for me in Simulator but not on a device. All capabilities are set correct, the fix as holospeed suggested does not work. What are we missing?