我正在实现自定义相机,为此我想设置曝光持续时间。
我设置 slider 属性的代码是-
slider.maximumValue = Float(CMTimeGetSeconds(camera.activeFormat.maxExposureDuration))
slider.minimumValue = Float(CMTimeGetSeconds(camera.activeFormat.minExposureDuration))
现在每当更改 slider 时设置曝光时间就会出现问题。
我的代码看起来像这样 -
change(duration: CMTimeMakeWithSeconds(Double(slider.value), 600), iso: AVCaptureISOCurrent)
但是在
func CMTimeMakeWithSeconds(_ seconds: Float64, _ preferredTimescale: Int32) -> CMTime
我对 preferredTimescale
感到困惑,它的值应该是多少,它在 600 下工作正常,但理想值是多少。
最佳答案
您应该查看讨论 here
Preferred time scale 将为你的秒数添加一个分母,这意味着如果你设置 5 秒并且 preferredTimeScale 为 60,它将是 1/12 秒
关于ios - CMTimeMakeWithSeconds 中的首选时间刻度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45348231/