Re: iOS 5: AVFoundation and MPMediaItemPropertyAssetURL
Re: iOS 5: AVFoundation and MPMediaItemPropertyAssetURL
- Subject: Re: iOS 5: AVFoundation and MPMediaItemPropertyAssetURL
- From: Rhythmic Fistman <email@hidden>
- Date: Fri, 06 Apr 2012 16:15:16 +0200
On 6 April 2012 01:56, John Michael Zorko <email@hidden> wrote:
>
> Hello, all ...
>
> I'm experimenting with making AVFoundation play local [purchased from] iTunes content on the device. I can set up an MPMediaQuery to fetch the content like so:
>
> MPMediaQuery *query = [[[MPMediaQuery alloc] init] autorelease];
> [query addFilterPredicate:[MPMediaPropertyPredicate predicateWithValue:[NSNumber numberWithInt:MPMediaTypeTVShow] forProperty:MPMediaItemPropertyMediaType]];
>
> ... and if I go through the query's items array, I can get the name and asset URL:
>
> for (MPMediaItem *item in [query items])
> {
> NSString *name = [item valueForProperty:MPMediaItemPropertyTitle];
> NSURL *url = [item valueForProperty:MPMediaItemPropertyAssetURL];
>
> NSLog(@" video name: %@ url: %@", name, url);
> }
>
> "video name: Plague of Babies / Bloaty's Pizza Hog url: ipod-library://item/item.m4v?id=4414454911022643168"
>
> I then make an AVURLAsset from the URL and ask AVFoundation to load said URL (ipod-library://item/item.m4v?id=4414454911022643168) via AVURLAsset loadValuesAsynchronouslyForKeys. The block is called, I make an AVPlayerItem, AVPlayer, attach the player to an AVPlayerLayer, etc. Everything seems cool. I call play once the AVPlayerItem's status is AVPlayerItemStatusReadyToPlay. I even see the playbackLikelyToKeepUp. However, nothing plays -- I don't see any errors, just nothing. Am I missing something? This same approach works well when playing a video from the application bundle as well as videos from the interwebz ...
iTunes purchased movies are DRMed, although film clips seem to be DRM free.
You should be seeing some indication of that somewhere, e.g. via
AVAsset.hasProtectedContent or zero tracks.
RF
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden