Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMediaPickerController with video media types not working

I am trying to browse video stored in my iPod library using the new video media types. With any video type I get this error on the console:

Warning: Unsupported media types (1024), using MPMediaTypeAny.

After this error, the picker only shows audio types.

For reference, these are the new media types available in iOS5.0 (defined in MediaPlayer.framework/MediaItem.h):

// video (available in iOS 5.0)
MPMediaTypeMovie        = 1 << 8,
MPMediaTypeTVShow       = 1 << 9,
MPMediaTypeVideoPodcast = 1 << 10,
MPMediaTypeMusicVideo   = 1 << 11,
MPMediaTypeVideoITunesU = 1 << 12,
MPMediaTypeAnyVideo     = 0xff00,
like image 494
bentford Avatar asked Feb 27 '12 23:02

bentford


2 Answers

Can you query the Movie library in code successfully e.g.:

MPMediaPropertyPredicate *predicate = [MPMediaPropertyPredicate predicateWithValue:[NSNumber numberWithInteger:MPMediaTypeMovie] forProperty:MPMediaItemPropertyMediaType];

MPMediaQuery *query = [[MPMediaQuery alloc] init];
[query addFilterPredicate:predicate];

NSArray *items = [query items];

for (MPMediaItem* item in items)
{
    NSString* title = [item valueForProperty:MPMediaItemPropertyTitle];

    url = [item valueForProperty:MPMediaItemPropertyAssetURL];

}

You should see all movie titles. This is OK for me on IOS5 and iPad 2. I still have your problem though. A workaround is putting the above code results in its own modal view.

like image 144
John Goodstadt Avatar answered Sep 28 '22 16:09

John Goodstadt


SWIFT 3 form @John Goodstadt

import MediaPlayer

let predicate = MPMediaPropertyPredicate(value: MPMediaType.any.rawValue, forProperty: MPMediaItemPropertyMediaType)
    let query = MPMediaQuery()
    query.addFilterPredicate(predicate)
    let items = query.items
    for item in items! {
        DLog("title: \(item.title); url: \(item.assetURL)")
    }

then you can change type as you need.

like image 30
Jerome Avatar answered Sep 28 '22 15:09

Jerome