views:

214

answers:

2

Hey,

I want to enable the user to select a video file from the on-device iPod library (so that I can play it in my own app). Is that possible? I was thinking on using MPMediaPickerController but I am not sure if it is able to select video files or just audio files.

Any help will be greatly appreciated.

Thanks,

A: 

The picker has a property called mediaTypes, this is an enumeration declared here, like this:

enum {
   // audio media types
   MPMediaTypeMusic        = 1 << 0,
   MPMediaTypePodcast      = 1 << 1,
   MPMediaTypeAudioBook    = 1 << 2,
   MPMediaTypeAnyAudio     = 0x00ff,

   // generic media type
   MPMediaTypeAny          = ~0
};

As you can see nothing indicates beeing something non-audio, except MPMediaTypeAny but the docs say

MPMediaTypeAny If set, the media item contains an unspecified type of audio.

That means only audio, sorry. :(

bddckr
Well, not the answer I was hoping for, but it does answer my question. Thanks!
Chonch
A: 

Do it like this:

IImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.delegate = self;
    imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
    // UIImagePickerControllerSourceTypeSavedPhotosAlbum;// UIImagePickerControllerSourceTypePhotoLibrary
    imagePicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:imagePicker.sourceType];
    imagePicker.allowsEditing = NO;