My app provides a video upload function. But after selecting the video, UIImagePickerController will perform video compression. 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
system is 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.
What you can do if you need this functionality is initialize the UIImagePickerController
with passthrough preset like this:
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.