Selecting video from PhotoLibrary using UIImagePickerController in OS 3.1

I am trying to select a video from a photo library. Basically I know how to do this, you set the mediaType for the image collector to NSArray with kUTTypeMovie as the only object. But it doesn't work on iPhone 3G. Starting with OS 3.1, you can store the video you received in your photo library. When you run a build in the Photos app, videos appear. However, this doesn't work with UIImagePickerController. The controller says it only supports images. When you try to set the mediaType of the controller using kUTTypeMovie it actually works.

If you do not specify the media type, only images are displayed in the collector.

How did anyone manage to select a video from a photo library? If so, does it only work on 3G or 3G?

Hello

Ben

+2


source to share


2 answers


I have an imagepicker working on 3g and 3gs to select a video.

NSArray *mediaTypesAllowed = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imgPicker setMediaTypes:mediaTypesAllowed];

      



And to get the selected video

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
    NSString *mediaType = [info valueForKey:UIImagePickerControllerMediaType];
    if([mediaType isEqualToString:@"public.movie"]){...}
}

      

+5


source


Hey, I also can't get movie objects in 3G using the above code. It crashes on my 3G. However, it works on my 3GS, but the problem is that it displays a mix of images and movies in the photo library. I tried the following code:

videoPickerCtrl.sourceType =  UIImagePickerControllerSourceTypePhotoLibrary;

NSArray *mediaTypesAllowed = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];

      

and on my 3GS running OS 3.1.2 it shows me a video with images stored in my photo library.



If I try to do the following:

videoPickerCtrl.sourceType =  UIImagePickerControllerSourceTypePhotoLibrary;
NSArray *mediaTypesAllowed = [NSArray arrayWithObject:@"public.movie"];
[videoPickerCtrl setMediaTypes:mediaTypesAllowed];

      

Then it all shows me the videos stored in the Camera Roll and nothing else. Can anyone please help?

+3


source







All Articles