简体   繁体   English

iphone imagepickerController从照片库中挑选视频

[英]iphone imagepickerController picking video from photo library

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.. 在这里,我可以使用uiimagepickercontoller在表视图中显示图像和视频,但我只能选择图像而不是视频..

How to pick a video form photo lib using UIimagepickercontroller.... 如何使用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]; 

` `

Check the docs and choose what type you need. 检查文档并选择所需的类型。

myImagePickerController.mediaTypes =
    [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];

It is Verified and Tested on Both iPhone and iPad For picking video. 它在iPhone和iPad上经过验证和测试用于选择视频。

@property (strong,nonatomic) UIPopoverController *popOver;

property is Set For iPad access. 物业是为iPad访问。

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];
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM