【问题标题】:Handling UIIMagePickerController when compressing video screen appears出现压缩视频画面时处理 UIIMagePickerController
【发布时间】:2012-11-29 09:49:33
【问题描述】:

我正在使用 UIImagePicker 从库中选择视频并尝试在我的应用程序中使用视频。为此,我正在使用这样的代码

picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

picker.delegate = self;
picker.mediaTypes=[NSArray arrayWithObject:(NSString*)kUTTypeMovie];
[self presentModalViewController:picker animated:YES];

Now the problem is that when any video is selected it shows compressing video message alongwith a progress bar.Meanwhile If I send my app in background I want to cancel this compression and dismismodalviewController so that corrupted compression does not occur.Is there any避免这种压缩或处理这种压缩的方法是成功或失败。设置 videoQuality 并不能解决问题。

【问题讨论】:

    标签: iphone objective-c background uiimagepickercontroller photo-gallery


    【解决方案1】:

    在我的例子中,来自 UIImagePickerControllerMediaType 的 URL 是 nil。解决方案是从UIImagePickerControllerReferenceURL获取视频网址:

    -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
                NSURL* url = [info objectForKey:UIImagePickerControllerReferenceURL];
                //... read video with ALAssetsLibrary
    }
    

    可以在此处找到有关如何阅读视频的更多信息:How to save video from assets url

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-12
      • 1970-01-01
      相关资源
      最近更新 更多