HHK1/PryntTrimmerView

Resolution/Fidelity

cosmicvarion opened this issue · 2 comments

Is there an easy way to check the smallest increment/decrement to time a user can make with the handles?

@HHK1 you should know

HHK1 commented

It's currently not implemented, but since the AVAssetTimeSelector is mapping the asset Time to the ui element width, you could easily get it if you modify a bit that class.

currently you have:

func getTime(from position: CGFloat) -> CMTime? {
        guard let asset = asset else {
            return nil
        }
        let normalizedRatio = max(min(1, position / durationSize), 0)
        let positionTimeValue = Double(normalizedRatio) * Double(asset.duration.value)
        return CMTime(value: Int64(positionTimeValue), timescale: asset.duration.timescale)
    }

So I guess that you could expose a method using that for the "smallest position increment" (i.e. 1 pixel or 1 point) and you'll get the corresponding minimal increment;