Achieve smooth video scrubbing with AVPlayer

前端 未结 4 1650
你的背包
你的背包 2021-01-02 02:30

I am trying to achieve smooth video scrubbing with AVPlayer through UISlider I have searched and it seems Apple has a Technical Q&A and explain

4条回答
  •  一整个雨季
    2021-01-02 03:13

    On slider value change event, just call the

    stopPlayingAndSeekSmoothlyToTime(CMTime.init(seconds: (player.currentItem?.asset.duration.seconds)!* slider.value, preferredTimescale: 1000))

    The Apples sample code will change the player current time. You can also adjust toleranceBefore and toleranceAfter if you scrub the slider really fast.

提交回复
热议问题