Open nigel-dev opened 9 years ago
Getting the same issue, any way of fixing it?
The plugin is flawed on this, as it always reports the audio as playing.
My quick fix was to add an extra boolean parameter, to tell if audio is playing or not:
- (void)updateMetas:(CDVInvokedUrlCommand*)command
{
...
NSNumber *isPlaying = [command.arguments objectAtIndex:6];
...
MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
center.nowPlayingInfo = [NSDictionary dictionaryWithObjectsAndKeys:
artist, MPMediaItemPropertyArtist,
title, MPMediaItemPropertyTitle,
album, MPMediaItemPropertyAlbumTitle,
artwork, MPMediaItemPropertyArtwork,
duration, MPMediaItemPropertyPlaybackDuration,
elapsed, MPNowPlayingInfoPropertyElapsedPlaybackTime,
isPlaying, MPNowPlayingInfoPropertyPlaybackRate, nil];
}
});
Using the plugin I am able to get all the play/pause/next/prev functionality on the lock screen and the control center. The issue that I am running into is that on the lock screen it always shows the pause button no mater if it is playing or not.
I am using @ghenry22 media plugin fork (https://github.com/ghenry22/cordova-plugin-media) for the ability to use the AVPlayer to stream mp3's