From d494a03f64fd1807a6f3f5bdda1b9c369a316ca2 Mon Sep 17 00:00:00 2001 From: Shridhar Goel <35566748+ShridharGoel@users.noreply.github.com> Date: Sat, 16 Mar 2024 00:59:56 +0530 Subject: [PATCH 1/3] Fix video replay issue in iOS --- src/components/VideoPlayer/BaseVideoPlayer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/VideoPlayer/BaseVideoPlayer.js b/src/components/VideoPlayer/BaseVideoPlayer.js index 92d829e9d0d..14f72e38902 100644 --- a/src/components/VideoPlayer/BaseVideoPlayer.js +++ b/src/components/VideoPlayer/BaseVideoPlayer.js @@ -102,7 +102,7 @@ function BaseVideoPlayer({ const currentDuration = e.durationMillis || videoDuration * 1000; const currentPositon = e.positionMillis || 0; - if (shouldReplayVideo(e, isVideoPlaying, currentDuration, currentPositon)) { + if (shouldReplayVideo(e, isPlaying, currentDuration, currentPositon)) { videoPlayerRef.current.setStatusAsync({positionMillis: 0, shouldPlay: true}); } From 338d3bf81c52316d6b948861eee6926cce6cb8f1 Mon Sep 17 00:00:00 2001 From: ShridharGoel <35566748+ShridharGoel@users.noreply.github.com> Date: Tue, 2 Apr 2024 17:13:02 +0530 Subject: [PATCH 2/3] Disable ESlint exhaustive deps since isPlaying shouldn't be a dependency --- src/components/VideoPlayer/BaseVideoPlayer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/VideoPlayer/BaseVideoPlayer.js b/src/components/VideoPlayer/BaseVideoPlayer.js index 14f72e38902..6dcd0a0ffe9 100644 --- a/src/components/VideoPlayer/BaseVideoPlayer.js +++ b/src/components/VideoPlayer/BaseVideoPlayer.js @@ -115,6 +115,7 @@ function BaseVideoPlayer({ onPlaybackStatusUpdate(e); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [onPlaybackStatusUpdate, preventPausingWhenExitingFullscreen, videoDuration], ); From aa15e02de517d8ba83fd4653443baa01002eb823 Mon Sep 17 00:00:00 2001 From: ShridharGoel <35566748+ShridharGoel@users.noreply.github.com> Date: Wed, 3 Apr 2024 01:42:02 +0530 Subject: [PATCH 3/3] Add comment for exhaustive dependencies ESlint skipping --- src/components/VideoPlayer/BaseVideoPlayer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/VideoPlayer/BaseVideoPlayer.js b/src/components/VideoPlayer/BaseVideoPlayer.js index 28d0a04ab3e..7016de3fa86 100644 --- a/src/components/VideoPlayer/BaseVideoPlayer.js +++ b/src/components/VideoPlayer/BaseVideoPlayer.js @@ -127,7 +127,7 @@ function BaseVideoPlayer({ videoStateRef.current = e; onPlaybackStatusUpdate(e); }, - // eslint-disable-next-line react-hooks/exhaustive-deps + // eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want to trigger this when isPlaying changes because isPlaying is only used inside shouldReplayVideo [onPlaybackStatusUpdate, preventPausingWhenExitingFullscreen, videoDuration], );