Implement onSeekComplete for Android #5

Merged
kkathuang merged 5 commits from kat/temp-4 into master 2024-08-26 17:23:33 -06:00
Showing only changes of commit c7a45d421b - Show all commits

View File

@ -229,6 +229,7 @@ public class ReactExoplayerView extends FrameLayout implements
*/ */
private boolean isSeeking = false; private boolean isSeeking = false;
private long seekPosition = -1; private long seekPosition = -1;
private boolean isSeekInProgress = false;
// Props from React // Props from React
private Source source = new Source(); private Source source = new Source();
@ -310,6 +311,7 @@ public class ReactExoplayerView extends FrameLayout implements
eventEmitter.onVideoSeekComplete.invoke(player.getCurrentPosition()); eventEmitter.onVideoSeekComplete.invoke(player.getCurrentPosition());
isSeeking = false; isSeeking = false;
seekPosition = -1; seekPosition = -1;
isSeekInProgress = false;
} }
} }
@ -1382,7 +1384,9 @@ public class ReactExoplayerView extends FrameLayout implements
playerControlView.show(); playerControlView.show();
} }
setKeepScreenOn(preventsDisplaySleepDuringVideoPlayback); setKeepScreenOn(preventsDisplaySleepDuringVideoPlayback);
handleSeekCompletion(); if (isSeekInProgress) {
handleSeekCompletion();
}
break; break;
case Player.STATE_ENDED: case Player.STATE_ENDED:
text += "ended"; text += "ended";
@ -2149,6 +2153,7 @@ public class ReactExoplayerView extends FrameLayout implements
public void seekTo(long positionMs) { public void seekTo(long positionMs) {
if (player != null) { if (player != null) {
isSeekInProgress = true;
isSeeking = true; isSeeking = true;
seekPosition = positionMs; seekPosition = positionMs;
player.seekTo(positionMs); player.seekTo(positionMs);