UIImagePickerController与AVCaptureSession视频预览冲突

时间:2015-04-16 00:15:19

标签: ios video ios8 uiimagepickercontroller avcapturesession

我有一个AVCaptureVideoPreviewLayer和一个AVCaptureSession来在屏幕上显示视频预览。

另外,我有UIImagePickerController来捕捉图片(使用UIImagePickerControllerOriginalImage)。

我的问题是,当我使用UIImagePickerController拍摄照片时,AVCaptureSession视频预览会冻结。

当我使用UIImagePickerController

拍摄照片时,如何防止视频预览冻结

1 个答案:

答案 0 :(得分:1)

在解除视频捕获会话后尝试创建新视图并在那里添加PBJViewcontroller,将视频路径字符串传递给viewcontroller对象。

例如:

[self dismissViewControllerAnimated:YES completion:nil];

UIView * movieVW = [[UIView alloc] initWithFrame:CGRectMake(0,44,1024,724)];

[previewBaseView addSubview:movieVW];

_videoPlayerController = [[PBJVideoPlayerController alloc] init];

_videoPlayerController.delegate = self;

_videoPlayerController.view.frame = movieVW.frame;

 NSString *myString = [outputURL absoluteString];

_videoPlayerController.videoPath = myString;

 [previewBaseView addSubview:_videoPlayerController.view];
相关问题