我正在尝试从网址加载强大并获取当前正在播放的歌曲的标题。
宋正在播放。一切都很好,直到我点击这个“得到歌曲标题”的墙。可悲的是NSLog(@"key = %@, value = %@", key, value);
没有任何回报。几乎被困在这里。
AVURLAsset *newAsset =[AVURLAsset assetWithURL:audioFileURL];
[newAsset loadValuesAsynchronouslyForKeys:keys completionHandler:^{
NSError *error = nil;
AVKeyValueStatus durationStatus = [newAsset statusOfValueForKey:@"commonMetadata" error:&error];
switch (durationStatus) {
case AVKeyValueStatusLoaded: {
playerItem = [AVPlayerItem playerItemWithAsset:newAsset];
self.player = [AVPlayer playerWithPlayerItem:playerItem];
NSArray *songMeta = [newAsset commonMetadata];
for (AVMetadataItem *item in songMeta ) {
NSString *key = [item commonKey];
NSString *value = [item stringValue];
NSLog(@"key = %@, value = %@", key, value);
}
break;
}
case AVKeyValueStatusFailed:
NSLog(@"Failed");
break;
default:
NSLog(@"Default");
break;
}
}];
由于