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
try to add selectors to your slider like this at the begining:
playerView.timeSlider.addTarget(self, action: #selector(PlayerViewController.timeSliderBeganTracking(_:)), for:.touchDown) // moved
playerView.timeSlider.addTarget(self, action: #selector(PlayerViewController.timeSliderEndedTracking(_:)), for: .touchUpInside)
playerView.timeSlider.addTarget(self, action: #selector(PlayerViewController.timeSliderEndedTracking(_:)), for: .touchUpOutside )
then in timeSliderBeganTracking set isSeekInProgress to true and pause your player and invalidate timers and remove observers if you have any
then in timeSliderEndedTracking
seek to current time like this :
let currentSeconds = Float64(self.playerView.timeSlider.value)
container.player.seek(to: CMTimeMakeWithSeconds(currentSeconds, 100))
then add the observers and timers back and at the end set isSeekInProgress to false
HERE you can find a complete sample of creating a custom videoPlayer