在一个基本的音频AVPlayer实例中,我们正在播放 HLS 流并设置 Now Playing 信息(成功),但无法访问MPNowPlayingInfoCenter正在设置的属性。
我们的category和active状态AVAudioSession也没有问题地接收远程控制事件。
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打印一个非常默认的字典,其中只包含一个of MPNowPlayingInfoPropertyPlaybackRate-0因为在日志期间正在播放音频,所以无论如何这都不准确。
我们想要检索当前设置的属性字典,更新一些,然后再次设置它们(例如专辑封面更新、播放/暂停时间等)。我们缺少什么?