[英]UIImagePickerController cancel button not working when compressing video
My app provides a video upload function. 我的应用提供视频上传功能。 But after selecting the video, UIImagePickerController will perform video compression.
但在选择视频后,UIImagePickerController将执行视频压缩。 At this time, clicking the Cancel button will not interrupt the compression process.
此时,单击“取消”按钮不会中断压缩过程。 Is there a way to solve this problem?
有没有办法解决这个问题? Reference Image: https://i.stack.imgur.com/mBSAv.png
参考图片: https : //i.stack.imgur.com/mBSAv.png
system is iOS 12.1 系统是iOS 12.1
let vc = UIImagePickerController()
vc.sourceType = .photoLibrary
vc.mediaTypes = [kUTTypeMovie as String]
vc.delegate = self
navigationController?.present(vc, animated: true, completion: nil)
//when compressing video left button is not responding
You can't interrupt the systems UIImagePickerController
video compression. 你无法中断系统
UIImagePickerController
视频压缩。
What you can do if you need this functionality is initialize the UIImagePickerController
with passthrough preset like this: 如果你需要这个功能你可以做的是初始化
UIImagePickerController
与passthrough预设如下:
if (@available(iOS 11.0, *))
picker.videoExportPreset = AVAssetExportPresetPassthrough;
Then you can fully manage compression with something like SDAVAssetExportSession
(that is a more feature-complete version of systems AVAssetExportSession
) and a modal view with a progress indicator and a cancel button that call cancelExport
of your exportSession
instance. 然后,你可以完全像管理压缩
SDAVAssetExportSession
(即系统的功能更加完善的版本AVAssetExportSession
)和一个进度指示一个模式的看法和取消按钮调用cancelExport
您的exportSession
实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.