使用UIImagePickerController在2G / 3G中选择视频 [英] Select videos using UIImagePickerController in 2G/3G

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

问题描述

我遇到一个问题,我无法在iPhone 2G / 3G设备中从相册中选择视频。默认照片应用程序确实显示视频,并且能够播放它们,这反过来意味着UIImagePickerController应该能够在相册中显示视频并选择它们。

I am facing a problem where-in I cannot select videos from the photo album in iPhone 2G/3G device. The default photos application does show videos and is capable of playing them, which in turn means that UIImagePickerController should clearly be capable of showing videos in photo album and selecting them.

我已对此进行编码以确定设备是否能够捕捉照片,录制视频,选择照片和选择视频:

I have coded this to determine whether the device is capable of snapping a photo, recording video, selecting photos and selecting videos:

 // Check if camera and video recording are available:
 [self setCameraAvailable:NO];
 [self setVideoRecordingAvailable:NO];
 [self setPhotoSelectionAvailable:NO];
 [self setVideoSelectionAvailable:NO];

 // For live mode:
 NSArray *availableTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
 NSLog(@"Available types for source as camera = %@", availableTypes);
 if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
 {
  if ([availableTypes containsObject:(NSString*)kUTTypeMovie])
   [self setVideoRecordingAvailable:YES];
  if ([availableTypes containsObject:(NSString*)kUTTypeImage])
   [self setCameraAvailable:YES];
 }

 // For photo library mode:
 availableTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
 NSLog(@"Available types for source as photo library = %@", availableTypes);
 if ([availableTypes containsObject:(NSString*)kUTTypeImage])
  [self setPhotoSelectionAvailable:YES];
 if ([availableTypes containsObject:(NSString*)kUTTypeMovie])
  [self setVideoSelectionAvailable:YES];

3G设备的日志如下:

The resulting logs for 3G device is as follows:

2010-05-03 19:09:09.623 xyz [348:207] Available types for source as camera = (
    "public.image"
)
2010-05-03 19:09:09.643 xyz [348:207] Available types for source as photo library = (
    "public.image"
)

根据日志状态,对于照片库,等效于kUTTypeMovie的字符串不可用,因此UIImagePickerController不会显示如果我们设置源类型数组包括kUTTypeMovie)在照片库中的电影文件,则抛出异常。

As the logs state, for photo library the string equivalent of kUTTypeMovie is not available and hence the UIImagePickerController does not show up (or rather throws exception if we set the source types array which includes kUTTypeMovie) the movie files in photo library.

我没有测试3GS,但我相信这个问题不

I havent tested for 3GS, but I am sure that this problem does not exist in it with reference to other threads.

我已经为3.0(基本SDK)和3.1构建了应用程序,但结果相同。

I have built the app for both 3.0 (base SDK) and 3.1 but with the same results.

这个问题已经在线程中讨论过了:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/36197-uiimagepickercontroller-does-not-show-movies-albums。 html

This issue is already discussed in the thread: http://www.iphonedevsdk.com/forum/iphone-sdk-development/36197-uiimagepickercontroller-does-not-show-movies-albums.html

但它似乎没有托管解决方案。

But it does not seem to host a solution.

这个问题的任何解决方案?

Any solutions to this problem?

感谢和问候,
Raj Pawan

Thanks and Regards, Raj Pawan

推荐答案

由于视频总是在被挑选之后被压缩(原始视频录像机文件非常大),并且2G / 3G模型不能对h.264进行硬件编码/解码,因此将它们从UIImagePickerController API中移除。这是不幸的,因为我们都喜欢在这些设备上选择视频。

As the videos are always compressed after being picked (the raw video recorder files are very big), and the 2G/3G models not being able to hardware encode/decode h.264, they left it out of the UIImagePickerController API. That is unfortunate as we all would love to pick videos on those devices as well.

这篇关于使用UIImagePickerController在2G / 3G中选择视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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