我已经启动并运行了我的MPNowPlayingInfoCenter,但是还有一个问题。不管我的实际播放器状态如何,MPNowPlayingInfoCenter总是“播放”并显示暂停按钮。按下它会触发暂停事件。
例如,当我的播放器更改状态时,我通过MPNowPlayingInfoCenter键更新MPNowPlayingInfoPropertyPlaybackRate。
是否有其他方法将MPNowPlayingInfoCenter状态设置为暂停?
任何暗示都很感激!
发布于 2014-06-16 11:47:05
发现问题是当第二个音频输出源播放,而我的包括媒体播放器被控制通过现在播放中心,它忽略了我的手动设置播放率,并检测到音频播放。
所以我的解决方案是暂停第二个音频。在我的情况下,这是可能的,但我不知道如何克服这一点,当第二个音频是关键的应用程序。我很乐意接受任何能更好地解决这个问题的答案。
发布于 2014-05-12 04:29:03
试试这个:
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];https://stackoverflow.com/questions/23583233
复制相似问题