2

我正在使用 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 way to avoid此压缩或处理此压缩以使结果成功或失败。设置 videoQuality 并不能解决问题。

4

1 回答 1

0

就我而言,来自的 URLUIImagePickerControllerMediaTypenil. 解决方案是从以下位置获取视频 URL UIImagePickerControllerReferenceURL

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

可以在此处找到有关如何阅读视频的更多信息:如何从资产 url 保存视频

于 2015-03-27T10:28:37.897 回答