PlayDetailViewController+Ext.swift 769 B

1234567891011121314151617181920212223242526272829
  1. //
  2. // PlayDetailViewController+Ext.swift
  3. // ColorfulWallpaper
  4. //
  5. // Created by ni on 2024/9/18.
  6. //
  7. import Foundation
  8. import SJVideoPlayer
  9. extension PlayDetailViewController: SJProgressSliderDelegate {
  10. func sliderWillBeginDragging(_ slider: SJProgressSlider) {
  11. playControl.pause()
  12. }
  13. func slider(_ slider: SJProgressSlider, valueDidChange value: CGFloat) {
  14. let durationTime = playControl.player.duration
  15. let currentTime = durationTime * value
  16. controlView.updateTime(currentTime: currentTime, duration: durationTime)
  17. }
  18. func sliderDidEndDragging(_ slider: SJProgressSlider) {
  19. playControl.seekToProgress(progress: slider.value) { _ in
  20. self.playControl.play()
  21. }
  22. }
  23. }