I would like to edit/compress video after selection like it was in UIImagePickerController
with allowsEditing = true
.
Still the new PHPickerViewController
doesn't have this property and Apple
says that there is no such property anymore here . But there are apps in App Store that pushing "allowsEditing controller" after selecting asset from PHPickerViewController
Here is my PHPickerViewController implementation:
func openImagePicker() {
if #available(iOS 14, *) {
var configuration = PHPickerConfiguration()
configuration.preferredAssetRepresentationMode = .automatic
let picker = PHPickerViewController(configuration: configuration)
// Set the delegate
picker.delegate = self
// Present the picker
present(picker, animated: true)
} else {
// Fallback on earlier versions
imagePicker?.photoGalleryAsscessRequest()
}
}
extension EditController: PHPickerViewControllerDelegate {
@available(iOS 14, *)
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
self.dismiss(animated: true)
}
}
I investigated this issue but indeed there is no support for like as you mention allowsediting
.
For example related to your question preset values for video edits was depreciated to UIImagePickerController.ImageURLExportPreset.compatible
but There is no support for automatic compression. The picker will always pass the original video/image and it is up to the app to do the necessary compressions or edits. You can check this Apple Document: imageExportPreset .
Apple specifically mentions that we should be using this new one instead of the older UIImagePickerViewController. If someone wonder more: Meet the new Photos picker
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.