iOS 11.1 UIImagePickerController video crop start

2020-07-24 05:50发布

We are displaying a UIImagePickerController for users to choose (and crop) a video for use within our app. Recently users have been experiencing issues trying to crop videos, with the start time handle becoming almost impossible to drag.

Handle

It seems that the Photos app doesn't have this issue because the video timeline (and crop selection) is moved to the bottom of the screen.

enter image description here

I assume this has to do with the new notification centre gestures that were added for the iPhone X. I believe this question here is related to the issue we're experiencing.

Anyone else having this issue, or have a way to get around it? Since this is a stock UIViewController I can't see how we can get around the issue without building our own custom video picker/cropper.

1条回答
趁早两清
2楼-- · 2020-07-24 06:26

I was having the same issue and I decided to disable the UIImagePickerController editing and catch the video path in the UIImagePIckerController's didFinishPickingMediaWithInfo, and then use UIVideoEditorController to edit the video. This is a quick example:

if UIVideoEditorController.canEditVideo(atPath: videoPath) {
    let editController = UIVideoEditorController()
    editController.videoPath = videoPath
    editController.delegate = self
    present(editController, animated:true)
}

For more information about UIVideoEditorController, check Apple's documentation: https://developer.apple.com/documentation/uikit/uivideoeditorcontroller?

查看更多
登录 后发表回答