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 ...

Regards,

John

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to