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