From 91fe41670f0060e6d648a88fd8255caa42eb3143 Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 29 Aug 2024 13:44:06 -0700 Subject: [PATCH] tweak (#5024) --- patches/expo-video+1.2.4.patch | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/patches/expo-video+1.2.4.patch b/patches/expo-video+1.2.4.patch index a159f7e5..0364dd63 100644 --- a/patches/expo-video+1.2.4.patch +++ b/patches/expo-video+1.2.4.patch @@ -250,7 +250,7 @@ index 3315b88..f482390 100644 if self.appContext != nil { self.emit(event: event, arguments: repeat each arguments) diff --git a/node_modules/expo-video/ios/VideoPlayerObserver.swift b/node_modules/expo-video/ios/VideoPlayerObserver.swift -index d289e26..d0fdd30 100644 +index d289e26..de9a26f 100644 --- a/node_modules/expo-video/ios/VideoPlayerObserver.swift +++ b/node_modules/expo-video/ios/VideoPlayerObserver.swift @@ -21,6 +21,7 @@ protocol VideoPlayerObserverDelegate: AnyObject { @@ -291,11 +291,11 @@ index d289e26..d0fdd30 100644 if isPlaying != (player.timeControlStatus == .playing) { isPlaying = player.timeControlStatus == .playing -+ addOrRemovePeriodicTimeObserver() ++ addPeriodicTimeObserverIfNeeded() } } -@@ -310,4 +317,30 @@ class VideoPlayerObserver { +@@ -310,4 +317,28 @@ class VideoPlayerObserver { } } } @@ -306,8 +306,8 @@ index d289e26..d0fdd30 100644 + } + } + -+ private func addOrRemovePeriodicTimeObserver() { -+ guard let player = self.player else { ++ private func addPeriodicTimeObserverIfNeeded() { ++ guard self.playerPeriodicTimeObserver == nil, let player = self.player else { + return + } + @@ -321,8 +321,6 @@ index d289e26..d0fdd30 100644 + let timeRemaining = (duration.seconds - event.seconds).rounded() + self.onPlayerTimeRemainingChanged(player, timeRemaining) + } -+ } else if let playerPeriodicTimeObserver = self.playerPeriodicTimeObserver { -+ player.removeTimeObserver(playerPeriodicTimeObserver) + } + } }