AVPlayer seekToTime does not play at correct position

前端 未结 5 1180
忘了有多久
忘了有多久 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:21

    Swift5

    let seconds = 45.0
    let time = CMTimeMake(value: seconds, timescale: 1)
    player?.seek(to: time, toleranceBefore: CMTime.zero, toleranceAfter: CMTime.zero)
    

提交回复
热议问题