Picking video from PhotoLibrary with UIImagePickerController in OS 3.1

后端 未结 2 734
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-18 14:37

I am trying to pick a video from the photo library. In principle I know how to do it you set the mediaType of the image picker to an NSArray with kUTTypeMovie as its only ob

相关标签:
2条回答
  • 2020-12-18 15:01

    I got the imagepicker working on a 3g and a 3gs to pick videos.

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

    And to get the picked video

    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
        NSString *mediaType = [info valueForKey:UIImagePickerControllerMediaType];
        if([mediaType isEqualToString:@"public.movie"]){...}
    }
    
    0 讨论(0)
  • 2020-12-18 15:02

    Hey, I am also unable to get movie objects on 3G using the above mentioned code. It crashes on my 3G. It however works on my 3GS, but the issue is it shows a mix of both images and movies in 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 videos cum images stored in my photo library.

    Whereas if I try doing the following:

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

    Then all it shows me is videos stored in Camera Roll, and nothing else. Can somebody help ?

    0 讨论(0)
提交回复
热议问题