From 134af2dd23d6b37cbbae58db1a9cf8aef098dc1c Mon Sep 17 00:00:00 2001 From: Kat Huang Date: Mon, 26 Aug 2024 10:16:29 -0600 Subject: [PATCH] Implement seekOnComplete --- ios/Video/RCTVideo.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index 5740cba1..4c9018f6 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -114,7 +114,11 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH @objc var onVideoProgress: RCTDirectEventBlock? @objc var onVideoBandwidthUpdate: RCTDirectEventBlock? @objc var onVideoSeek: RCTDirectEventBlock? - @objc var onVideoSeekComplete: RCTDirectEventBlock? + @objc var onVideoSeekComplete: RCTDirectEventBlock? { + didSet { + print("onVideoSeekComplete set: \(onVideoSeekComplete != nil)") + } +} @objc var onVideoEnd: RCTDirectEventBlock? @objc var onTimedMetadata: RCTDirectEventBlock? @objc var onVideoAudioBecomingNoisy: RCTDirectEventBlock? @@ -777,6 +781,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH let toleranceTime = CMTimeMakeWithSeconds(Float64(tolerance.floatValue), preferredTimescale: Int32(NSEC_PER_SEC)) let currentTimeBeforeSeek = CMTimeGetSeconds(item.currentTime()) + print("Before seek - Current time: \(currentTimeBeforeSeek), Seeking to: \(time)") // Call onVideoSeek before starting the seek operation let currentTime = NSNumber(value: Float(currentTimeBeforeSeek)) @@ -1676,4 +1681,3 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH @objc func setOnClick(_: Any) {} } -