I'm trying to get the trackNumber of a aac, mp3 or mp4 file. It's not in the commonMetadata so I started to spelunk in the other metadata keys. I found something that looks like it, but I'm yet unable to read it, and make sense of it. Even the raw data makes no sense to me.
At the moment, I'm just trying to get it using this basic code:
NSArray *meta = [asset metadataForFormat:AVMetadataFormatiTunesMetadata];
for ( AVMetadataItem* item in meta ) {
id key = [item key];
NSString *value = [item stringValue];
NSLog(@"key = %@, value = %@", key, value);
}
Knowing I'm looking for AVMetadataiTunesMetadataKeyTrackNumber.
If your track has ID3 metadata, you can easily get the numberValue for the track number. If your track has iTunesMetadata, the dataValue is all you get. You have to guess the intValue yourself.
So far, I'm here. I'm pretty sure I need to work more on the bytes portion.