使用OS 3.1中的UIImagePickerController从PhotoLibrary中选取视频 [英] Picking video from PhotoLibrary with UIImagePickerController in OS 3.1

查看:136
本文介绍了使用OS 3.1中的UIImagePickerController从PhotoLibrary中选取视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从照片库中挑选视频。原则上我知道怎么做你将图像选择器的mediaType设置为NSArray,其中kUTTypeMovie是唯一的对象。
但这似乎不适用于iPhone 3G。从OS 3.1开始,您可以存储在照片库中收到的视频。当您在照片应用程序中开始构建时,会显示视频。但是,使用UIImagePickerController不起作用。控制器报告它仅支持图像。当您尝试使用kUTTypeMovie设置控制器的mediaType时,它实际上会崩溃。

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 object. But this doesn't seem to work on an iPhone 3G. Since OS 3.1 you can store videos you've received in your photo library. When you start the build in 'Photos' application the videos appear. However this doesn't work using the UIImagePickerController. The controller reports that it only supports images. When you try to set the mediaType of the controller with kUTTypeMovie it actually crashes.

如果您没有指定媒体类型,则只有图像显示在选择器中。

If you don't specify the media type only images are shown in the picker.

当有人设法从照片库中挑选视频时?如果是,它只适用于3gs或3G吗?

As anyone managed to pick a video from the photo library? If yes did it only work on the 3gs or on the 3G as well?

问候

Ben

推荐答案

我让imagepicker工作在3g和3gs上来挑选视频。

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

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

并获取所选视频

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

这篇关于使用OS 3.1中的UIImagePickerController从PhotoLibrary中选取视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆