HHK1 / PryntTrimmerView

A set of tools to trim, crop and select frames inside a video
MIT License
835 stars 199 forks source link

Minimum trim video issue #52

Open tallot13 opened 5 years ago

tallot13 commented 5 years ago

from PryntTrimmerView.swift /// The minimum duration allowed for the trimming. The handles won't pan further if the minimum duration is attained. public var minDuration: Double = 3 I trim to the minimum possible, but in didChangePositionBar from TrimmerViewDelegate

let timeRange = CMTimeRangeFromTimeToTime(start: trimmerView.startTime ?? CMTime.zero, end: trimmerView.endTime ?? inputAsset.duration)
print("time range duration seconds: \(timeRange.duration.seconds)")
print("time range duration: \(timeRange.duration)")

Output:

time range duration seconds: 2.995 time range duration: CMTime(value: 1797, timescale: 600, flags: __C.CMTimeFlags(rawValue: 1), epoch: 0)

time range duration seconds: 2.993333333333333 time range duration: CMTime(value: 1796, timescale: 600, flags: __C.CMTimeFlags(rawValue: 1), epoch: 0)

I have a strict check on the length of the video and its minimum 3 seconds, but with such a duration the check fails