视频修整器的范围滑块的触摸(框)“关闭”。 [英] Range slider's touch (box) of video trimmer "off"
问题描述
我正在使用
使用黑色手柄根据需要修剪视频
修剪视频
注意::句柄之间的最小允许距离在<$中指定c $ c> PryntTrimmerView.swift 使用私有财产的文件。
///修剪所允许的最短持续时间。如果达到最小持续时间,手柄将不会进一步平移。
public var minDuration:Double = 2
此函数使用此属性以及视频持续时间和框架来计算最小距离bw句柄
private var minimumDistanceBetweenHandle:CGFloat {
guard let asset = asset else {return 0}
let distance = CGFloat(minDuration)* assetPreview.contentView.frame.width / CGFloat(asset.duration.seconds)
print(最小距离:\(距离))
返回距离
}
如果您遇到任何问题或需要更多信息,请告诉我
谢谢
I am using FDTake (the pod wont be too important for this question but still) to select videos from Photos which works fine. However, I would also like to be able to edit videos and limit their length to about 12 seconds. To do so I looked at the code of the pod and changed line 271 to self.imagePicker.allowsEditing = true
which already causes the problem I haven't been able to solve so far: The left slider's touch (box) is "off". Since that's a rather vague description I uploaded a video and you can find it right here.
Unfortunately, I have absolutely no idea what engenders the problem and would really appreciate some help with this. I asked the creator of FDTake but apparently he thinks that Apple needs to fix this (as you'll be able to see in one of the latest closed issues).
Can someone explain how I can fix this and what is causing it?
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
Use the black handles to trim the video as desired
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
这篇关于视频修整器的范围滑块的触摸(框)“关闭”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!