AssetUrl for a MPMediaItem returns nil
| Originator: | madhu.wagle | ||
| Number: | rdar://21385466 | Date Originated: | |
| Status: | Open | Resolved: | |
| Product: | Audible | Product Version: | |
| Classification: | Reproducible: | Almost Always |
We are trying to retrieve Metadata for Audiobooks in Itunes. Online we were asked to retrieve the AVURLAsset for this MPMediaItem. Inorder to retrieve the AVURLAsset, we access the property MPMediaItemPropertyAssetURL on MPMediaItem instance. However for most of the titles, we retrieve a nil URL. We want to know if this is a bug or some licensing issue. Please let us know If we should use some other API. Does iBook use a different API as they show chapters ?
Steps to Reproduce: NSURL *assetURL = [self.mediaItem valueForProperty:MPMediaItemPropertyAssetURL]; / if (assetURL) { AVURLAsset *asset = [AVURLAsset URLAssetWithURL:assetURL options:nil]; NSArray *locales = [asset availableChapterLocales]; for (NSLocale *locale in locales) { NSArray *chaptersByLocale = [asset chapterMetadataGroupsWithTitleLocale:locale containingItemsWithCommonKeys:[NSArray arrayWithObject:AVMetadataCommonKeyArtwork]]; [chapters addObjectsFromArray:chaptersByLocale]; } }
Expected Results: NSURL *assetURL = [self.mediaItem valueForProperty:MPMediaItemPropertyAssetURL]; returns a valid URL for the AVURLAsset.
Actual Results: NSURL *assetURL = [self.mediaItem valueForProperty:MPMediaItemPropertyAssetURL]; returns nil
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!
iBooks is able to retrieve the chapter content for these titles. Wondering if we are using the wrong API?