HHK1 / PryntTrimmerView

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

Resolution/Fidelity #78

Open cosmicvarion opened 3 years ago

cosmicvarion commented 3 years ago

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

NikKovIos commented 3 years ago

@HHK1 you should know

HHK1 commented 3 years ago

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;