From c7a45d421b168dcc61235ee06c684c9fbbc05eb9 Mon Sep 17 00:00:00 2001 From: Kat Huang Date: Sat, 17 Aug 2024 18:04:24 -0600 Subject: [PATCH] Only complete seek if seek was in progress --- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 3d4ff996..ac435dcc 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -229,6 +229,7 @@ public class ReactExoplayerView extends FrameLayout implements */ private boolean isSeeking = false; private long seekPosition = -1; + private boolean isSeekInProgress = false; // Props from React private Source source = new Source(); @@ -310,6 +311,7 @@ public class ReactExoplayerView extends FrameLayout implements eventEmitter.onVideoSeekComplete.invoke(player.getCurrentPosition()); isSeeking = false; seekPosition = -1; + isSeekInProgress = false; } } @@ -1382,7 +1384,9 @@ public class ReactExoplayerView extends FrameLayout implements playerControlView.show(); } setKeepScreenOn(preventsDisplaySleepDuringVideoPlayback); - handleSeekCompletion(); + if (isSeekInProgress) { + handleSeekCompletion(); + } break; case Player.STATE_ENDED: text += "ended"; @@ -2149,6 +2153,7 @@ public class ReactExoplayerView extends FrameLayout implements public void seekTo(long positionMs) { if (player != null) { + isSeekInProgress = true; isSeeking = true; seekPosition = positionMs; player.seekTo(positionMs);