AVPlayer seekToTime does not play at correct position

前端 未结 5 1232
忘了有多久
忘了有多久 2021-01-31 03:31

I have an AVPlayer which is playing a HLS video stream. My user interface provides a row of buttons, one for each \"chapter\" in the video (the buttons are labeled \"1\", \"2\",

5条回答
  •  悲&欢浪女
    2021-01-31 04:06

    Put this code it may be resolve your problem.

    let targetTime = CMTimeMakeWithSeconds(videoLastDuration, 1) // videoLastDuration hold the previous video state.
    self.playerController.player?.currentItem?.seekToTime(targetTime, toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero)
    

提交回复
热议问题