commonMetadata for AVURLAssets created from MPMediaItems
| Originator: | drew.hess | ||
| Number: | rdar://13468765 | Date Originated: | 20-Mar-2013 05:58 PM |
| Status: | Open | Resolved: | |
| Product: | iPhone SDK | Product Version: | 6.1.3 |
| Classification: | Other Bug | Reproducible: |
20-Mar-2013 05:58 PM Drew Hess:
Summary: The commonMetadata dictionary for AVURLAssets created from MPMediaItems is missing common metadata.
Steps to Reproduce:
1. Query the iPod library, e.g.:
MPMediaQuery *artistQuery = [MPMediaQuery albumsQuery];
2. Get the items from the query, e.g.:
[artistQuery items];
3. Create an AVURLAsset using the URL of each item, obtained via
[item valueForProperty:MPMediaItemPropertyAssetURL];
4. Fetch each asset's commonMetadata property, e.g.:
[asset loadValuesAsynchronouslyForKeys:@["commonMetadata"] completionHandler...];
5. In the completion handler, print the contents of the asset's commonMetadata property, e.g.:
NSLog(@"commonMetadata: %@", asset.commonMetadata);
Expected Results:
For tracks with metadata such as track title and album name, commonMetadata should include these tags. Indeed, using the same code to load commonMetadata from AVURLAssets created from HTTP URLs that point to MP3 media, rather than from MPMediaItems, these tags are present in commonMetadata when the track contains them.
Actual Results:
commonMetadata for AVURLAssets created from MPMediaItem URLs contains either no metadata (for DRM-free tracks downloaded from the iTunes Store), or only the "software" tag, for tracks synced to the iPhone from the user's iTunes library. Here is an example of the commonMetadata property from such a track:
2013-03-20 17:40:09.343 AppName[4209:907] commonMetadata: (
"<AVMutableMetadataItem: 0x1d888f40, keySpace=itsk, key=\U00a9too, commonKey=software, locale=(null), value=iTunes 11.0.2, time={INVALID}, duration={INVALID}, extras={\n dataType = 1;\n}>"
The title, album name, etc., are available directly from the MPMediaItem, e.g.,:
[mediaItem valueForProperty:MPMediaItemPropertyTitle];
but surely these tags should also be present in the AVURLAsset's commonMetadata property.
Regression: The problem occurs in iOS 6.1.x, at least. There are (unresolved) reports of similar behavior in the Apple Developer forums dating back nearly a year, as well.
Notes:
I'm able to work around this problem with some hacks to special-case AVAssets created from MPMediaItems, but as the AV Foundation documentation makes no mention of this behavior, I consider it a bug.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!