Question

I have my MPNowPlayingInfoCenter up and running but one problem remains. regardless of my actual player state the MPNowPlayingInfoCenter is always "playing" and displays the pause button. When pressed it fires the pause event.

When my player changes state, for example to paused, i update the MPNowPlayingInfoCenter via the MPNowPlayingInfoPropertyPlaybackRate key.

Is there any other way to set the MPNowPlayingInfoCenter state to paused?

Any hints appreciated!

Was it helpful?

Solution 2

Found out the issue was when a second source of audio output was playing while my included media player was controlled via nowplayingcenter it somehow ignored my manually set playback rate and detected audio playing.

So the solution for me was to pause the second audio as well. In my situation this was possible but i don't know how to overcome this when the second audio is critical for the app. I'll happily accept any answer which solves this issue more elegantly.

OTHER TIPS

Try this:

 NSMutableDictionary *currentlyPlayingTrackInfo = [NSMutableDictionary dictionaryWithCapacity:7];
 currentlyPlayingTrackInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = @((Float64)[player currentTime]);
    if (!SYSTEM_VERSION_OF_DEVICE_LESS_THAN(@"7.0"))
    {
        currentlyPlayingTrackInfo[MPNowPlayingInfoPropertyPlaybackRate] = [NSNumber numberWithDouble:_isHere == NO?1:0];
    }
    else
    {
        currentlyPlayingTrackInfo[MPNowPlayingInfoPropertyPlaybackRate] = [NSNumber numberWithDouble:1];
    }
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:currentlyPlayingTrackInfo];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top