iphone imagepickerController 从照片库中挑选视频

发布于 2024-10-21 20:14:23 字数 532 浏览 1 评论 0原文

我现在正在尝试实现一个应用程序,例如从设备相册中选取图像和视频并将其上传到服务器。

在这里我可以使用 uiimagepickercontoller 在表格视图中显示图像和视频,但我只能选取图像而不是视频..

如何使用 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]; 

`

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

`

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

春花秋月 2024-10-28 20:14:23

检查 docs 并选择您需要的类型。

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

Check the docs and choose what type you need.

myImagePickerController.mediaTypes =
    [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
眼眸 2024-10-28 20:14:23

它已在 iPhone 和 iPad 上进行验证和测试,用于挑选视频。

@property (strong,nonatomic) UIPopoverController *popOver;

属性设置为 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];
}

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];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文