iphone imagepickerController picking video from ph

2019-01-25 22:43发布

I am now trying to implement a app like picking image and video from device photo album and uploading it to server..

here i can able to display both image and video in a table view using uiimagepickercontoller but i can only able to pick image not video..

How to pick a video form photo lib using UIimagepickercontroller....

UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
ipc.sourceType =  UIImagePickerControllerSourceTypePhotoLibrary;
ipc.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:ipc.sourceType];     
ipc.delegate = self;
ipc.editing = NO;
[self presentModalViewController:ipc animated:YES]; 

`

2条回答
够拽才男人
2楼-- · 2019-01-25 23:07

Check the docs and choose what type you need.

myImagePickerController.mediaTypes =
    [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
查看更多
啃猪蹄的小仙女
3楼-- · 2019-01-25 23:22

It is Verified and Tested on Both iPhone and iPad For picking video.

@property (strong,nonatomic) UIPopoverController *popOver;

property is Set For iPad access.

UIImagePickerController *videoPicker=[[UIImagePickerController alloc] init];
videoPicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
videoPicker.mediaTypes=[[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
videoPicker.delegate=self;

if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    UIPopoverController *popController=[[UIPopoverController alloc] initWithContentViewController:videoPicker];
    [popController presentPopoverFromRect:CGRectMake(0, 600, 160, 300) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    self.popOver=popController;
}
else
{
    [self presentViewController:videoPicker animated:YES completion:nil];
}
查看更多
登录 后发表回答