Reputation: 91
I am trying to get ID3 tags from MP3 file in Objective-C. I found how to do that with MPMusicPlayer but I am making an application which can play music from URL and MPMusicPlayer is not useful for me, I should use AVPlayer.. Maybe some one can help me with getting ID3 tags from AVPlayer? I need to get Artwork picture.
Upvotes: 2
Views: 2772
Reputation: 4975
NSString *path = @"path/file.mp3";
NSURL *url = [[NSURL alloc] initFileURLWithPath:path];
AVAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
NSArray *metadata = [asset commonMetadata];
for ( AVMetadataItem* item in metadata ) {
NSString *key = [item commonKey];
NSString *value = [item stringValue];
NSLog(@"key = %@, value = %@", key, value);
}
Upvotes: 7