尝试播放我正在观看“timedMetadata”的实时音频流 正在检索正常的数据项,例如内容标题和网址。但是有一些额外的数据作为ICEcast的一部分,基本上用于播放Ads.This数据在Charles中可见,但未在AVMetadataItem中填充< / p>
for (AVMetadataItem *data in item.timedMetadata) {
NSLog(@"Identifier : %@",data.identifier);
NSLog(@"Value : %@",data.value);
NSLog(@"Datatype : %@",data.dataType);
}
我在这里遗漏了什么吗?相同的数据可以在Matt的AudioStreamer类中检索。可以通过AVPlayer完成吗?它是否属于不同的观察者? 1.我如何获得这些数据?
AVPlayerItem *item = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:urlString]];
self.songPlayer = [AVPlayer playerWithPlayerItem:item];
CALayer *superlayer = self.playerView.layer;
AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.songPlayer];
[playerLayer setFrame:self.playerView.bounds];
playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
[superlayer addSublayer:playerLayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerItemDidReachEnd:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:[self.songPlayer currentItem]];
[item addObserver:self forKeyPath:@"status" options:0 context:nil];
[item addObserver:self forKeyPath:@"currentItem" options:0 context:nil];
[item addObserver:self forKeyPath:@"timedMetadata" options:0 context:nil];