From 5212eddf0a4f2a97b3e8810da18b64ab7ef92a97 Mon Sep 17 00:00:00 2001 From: kononenkoAnton Date: Wed, 29 May 2024 08:39:03 -0400 Subject: [PATCH] fix: post seeking notification before initiating AVPlayer seek operation (#476) --- Classes/Player/AVPlayerEngine/AVPlayerEngine.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Classes/Player/AVPlayerEngine/AVPlayerEngine.swift b/Classes/Player/AVPlayerEngine/AVPlayerEngine.swift index 8852acf6..34a941b5 100644 --- a/Classes/Player/AVPlayerEngine/AVPlayerEngine.swift +++ b/Classes/Player/AVPlayerEngine/AVPlayerEngine.swift @@ -130,16 +130,17 @@ public class AVPlayerEngine: AVPlayer { } let newTime = self.rangeStart + CMTimeMakeWithSeconds(value, preferredTimescale: self.rangeStart.timescale) PKLog.debug("set currentPosition: \(CMTimeGetSeconds(newTime))") + + self.post(event: PlayerEvent.Seeking(targetSeekPosition: CMTimeGetSeconds(newTime))) super.seek(to: newTime, toleranceBefore: CMTime.zero, toleranceAfter: CMTime.zero) { [weak self] (isSeeked: Bool) in guard let self = self else { return } if isSeeked { self.post(event: PlayerEvent.Seeked()) PKLog.debug("seeked") } else { - PKLog.error("seek faild") + PKLog.error("seek failed") } } - self.post(event: PlayerEvent.Seeking(targetSeekPosition: CMTimeGetSeconds(newTime))) } }