简体   繁体   English

PHPickerViewController 添加视频编辑屏幕 aka (UIImagePickerController.allowsEditing = true)

[英]PHPickerViewController add video editing screen aka (UIImagePickerController.allowsEditing = true)

I would like to edit/compress video after selection like it was in UIImagePickerController with allowsEditing = true .我想在选择后编辑/压缩视频,就像在UIImagePickerController中一样,使用allowsEditing = true

Still the new PHPickerViewController doesn't have this property and Apple says that there is no such property anymore here .新的PHPickerViewController仍然没有这个属性, Apple这里不再有这个属性。 But there are apps in App Store that pushing "allowsEditing controller" after selecting asset from PHPickerViewController但是 App Store 中有应用程序在从PHPickerViewController选择资产后推送“allowsEditing 控制器”

Here is my PHPickerViewController implementation:这是我的 PHPickerViewController 实现:

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 .我调查了这个问题,但确实不支持 like 你提到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.例如,与您的问题预设值相关的视频编辑已折旧为UIImagePickerController.ImageURLExportPreset.compatible但不支持自动压缩。 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 文档: imageExportPreset

Apple specifically mentions that we should be using this new one instead of the older UIImagePickerViewController.苹果特别提到我们应该使用这个新的而不是旧的 UIImagePickerViewController。 If someone wonder more: Meet the new Photos picker如果有人想知道更多:认识新的照片选择器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UIImagePickerController allowEditing = YES仅用于视频 - UIImagePickerController allowsEditing=YES just for video 如何使用[camera takePhoto]和使用UIImagePicker编辑-UIImagePickerController.allowsEditing = YES - How do I use [camera takePhoto] and edit using UIImagePicker - UIImagePickerController.allowsEditing = YES UIImagePickerController允许编辑= YES,修剪后获得未修剪的视频 - UIImagePickerController allowsEditing = YES, getting untrimmed video after trimming UIImagePickerController allowEditing = YES不起作用 - UIImagePickerController allowsEditing = YES not working UIImagePickerController 允许编辑不起作用 - UIImagePickerController AllowsEditing not working 当 property.allowsEditing 设置为 true 时,UIImagePickerController 返回右侧黑色背景的图像 - UIImagePickerController returns image with black background on right side when the property .allowsEditing is set to true UIImagePickerController在allowEditing中隐藏正方形选择 - UIImagePickerController hide square selection in allowsEditing 将图像加载到本机UIImagePickerController允许编辑 - Loading Images into native UIImagePickerController allowsEditing cameraOverlayView阻止使用allowsEditing进行编辑 - cameraOverlayView prevents editing with allowsEditing UIImagePickerController使用allowsEditing推送viewcontroller错误 - UIImagePickerController push viewcontroller bug with allowsEditing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM