Clear progress messages on STATE_IDLE and STATE_BUFFERING (#1768)
The progress message handler will duplicate recursions of the `onProgressMessage` handler on change of player state from any state to STATE_READY with `playWhenReady` is true (when video is not paused). This clears the messages on STATE_IDLE and STATE_BUFFERING to break the recursion.
This commit is contained in:
parent
b675e59162
commit
b97663e092
@ -625,10 +625,12 @@ class ReactExoplayerView extends FrameLayout implements
|
||||
case Player.STATE_IDLE:
|
||||
text += "idle";
|
||||
eventEmitter.idle();
|
||||
clearProgressMessageHandler();
|
||||
break;
|
||||
case Player.STATE_BUFFERING:
|
||||
text += "buffering";
|
||||
onBuffering(true);
|
||||
clearProgressMessageHandler();
|
||||
break;
|
||||
case Player.STATE_READY:
|
||||
text += "ready";
|
||||
@ -657,6 +659,15 @@ class ReactExoplayerView extends FrameLayout implements
|
||||
progressHandler.sendEmptyMessage(SHOW_PROGRESS);
|
||||
}
|
||||
|
||||
/*
|
||||
The progress message handler will duplicate recursions of the onProgressMessage handler
|
||||
on change of player state from any state to STATE_READY with playWhenReady is true (when
|
||||
the video is not paused). This clears all existing messages.
|
||||
*/
|
||||
private void clearProgressMessageHandler() {
|
||||
progressHandler.removeMessages(SHOW_PROGRESS);
|
||||
}
|
||||
|
||||
private void videoLoaded() {
|
||||
if (loadVideoStarted) {
|
||||
loadVideoStarted = false;
|
||||
|
Loading…
Reference in New Issue
Block a user