2
我正在尝试获取元数据,例如我的网址的艺术家名称/曲目名称,但是我没有看到,要得到它,我不太确定我缺少什么,音频加载并播放就好:从流中获取元数据问题?
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.mainTitle.text = _stationName;
NSString *u = @"http://pub1.sky.fm:80/sky_solopiano";
NSURL *url = [NSURL URLWithString:u];
radiosound = [[AVPlayer alloc] initWithURL:url];
[radiosound play];
}
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
AVPlayerItem * item = (AVPlayerItem*)object;
NSLog(@"%@", item.timedMetadata);
}
更新每在这个问题上成员的建议,我试图实现
AVAsset *info = radiosound.currentItem.asset;
NSLog(@"%@",info);
而不是
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
AVPlayerItem * item = (AVPlayerItem*)object;
NSLog(@"%@", item.timedMetadata);
}
但这只是回报,我已经知道,并没有刷新数据,它目前返回:
<AVURLAsset: 0x109c7ccf0, URL = http://pub1.sky.fm:80/sky_solopiano>
我刚刚尝试了你的建议,而我确实收到了一些数据,它只是以下内容:''不是实际的元我正在寻找的数据,还有其他建议吗? –
vzm