Range slider's touch (box) of video trimmer "off" Range slider's touch (box) of video trimmer "off" swift swift

Range slider's touch (box) of video trimmer "off"


One possible Solution: Select the video and then trim the video using PryntTrimmerView

You can use PryntTrimmerView library for trimming the videos. I have implemented this library in a sample project. You can download the running sample project from my github repo Here

The load random video button loads a random video from device's storage (photos). Therefore atleast one video file needs to be present

An Avplayer is being used for displaying the video

This is complete video

Complete video

Use the black handles to trim the video as desired

Trimming the Video

Trimming the video


Note: : Minimum Allowed distance between handles is specified in PryntTrimmerView.swift file using a private property.

/// The minimum duration allowed for the trimming. The handles won't pan further if the minimum duration is attained.  public var minDuration: Double = 2

And this function uses this property along with video duration and frame to calculate minimum distance bw handles

private var minimumDistanceBetweenHandle: CGFloat {    guard let asset = asset else { return 0 }    let distance = CGFloat(minDuration) * assetPreview.contentView.frame.width / CGFloat(asset.duration.seconds)    print("minimum distance: \(distance)")    return distance  }

Let me know if you encounter any problems or need more information

Thanks


I've reproduced the issue using an UIImagePickerController directly.

Here is some code that you can call from your viewController:

 let picker = UIImagePickerController() picker.allowsEditing = true picker.mediaTypes = [String(kUTTypeMovie)] picker.videoMaximumDuration = 12.0 present(picker, animated: true, completion: nil)

My guess is that there is a gesture conflict with some internal view only on the left side of the screen, once you've pulled the left handle somewhere in the middle, you can access it directly.

Also, this does not seem to be new: IOS 11 UIImagepicker for video how to move the slider to the bottom?

The best thing you can do is to file a radar to Apple.

In the meantime, you can use the library suggested by Awais Fayyaz as a workaround. (Disclaimer: I'm the author of the library, so I am biased of course).Another option would be to use an UIVideoEditorController once the user has selected the video, that component does not have any issue on iOS 11.


We've had the same problem here. It certainly has to do with gestures on the left side of the screen.

When you add additionalSafeAreaInsets to your UIImagePickerController it works much better.

This is what we tried:

 let imagePickerController = UIImagePickerController() imagePickerController.allowsEditing = true imagePickerController.mediaTypes = [kUTTypeMovie as String] imagePickerController.videoMaximumDuration = 12.0 imagePickerController.additionalSafeAreaInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)

We ended up using the UIVideoEditorController.