【发布时间】:2014-04-28 15:54:03
【问题描述】:
在基本音频 AVPlayer 实例中,我们正在播放 HLS 流并设置正在播放信息(成功),但无法访问正在设置的 MPNowPlayingInfoCenter 的属性。
我们的AVAudioSession 的category 和active 状态也是receiving remote control events 也没有问题。
NSMutableDictionary *properties = [[NSMutableDictionary alloc] init];
[properties setObject:title forKey:MPMediaItemPropertyTitle];
// Set several other properties
MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
[center setNowPlayingInfo:properties];
// Works! The lock screen successfully shows the title and other properties
NSLog("%@", [center nowPlayingInfo]);
NSLog 打印出一个非常默认的字典,其中仅包含 0 中的 MPNowPlayingInfoPropertyPlaybackRate - 由于在日志期间正在播放音频,因此无论如何这都不准确。
我们想retrieve the currently-set dictionary of properties,更新一些,然后重新设置它们(用于专辑封面更新、播放/暂停时间等)。我们缺少什么?
【问题讨论】:
标签: ios avfoundation avplayer mpnowplayinginfocenter