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:
|
case Player.STATE_IDLE:
|
||||||
text += "idle";
|
text += "idle";
|
||||||
eventEmitter.idle();
|
eventEmitter.idle();
|
||||||
|
clearProgressMessageHandler();
|
||||||
break;
|
break;
|
||||||
case Player.STATE_BUFFERING:
|
case Player.STATE_BUFFERING:
|
||||||
text += "buffering";
|
text += "buffering";
|
||||||
onBuffering(true);
|
onBuffering(true);
|
||||||
|
clearProgressMessageHandler();
|
||||||
break;
|
break;
|
||||||
case Player.STATE_READY:
|
case Player.STATE_READY:
|
||||||
text += "ready";
|
text += "ready";
|
||||||
@ -636,7 +638,7 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
onBuffering(false);
|
onBuffering(false);
|
||||||
startProgressHandler();
|
startProgressHandler();
|
||||||
videoLoaded();
|
videoLoaded();
|
||||||
//Setting the visibility for the playerControlView
|
// Setting the visibility for the playerControlView
|
||||||
if (playerControlView != null) {
|
if (playerControlView != null) {
|
||||||
playerControlView.show();
|
playerControlView.show();
|
||||||
}
|
}
|
||||||
@ -657,6 +659,15 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
progressHandler.sendEmptyMessage(SHOW_PROGRESS);
|
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() {
|
private void videoLoaded() {
|
||||||
if (loadVideoStarted) {
|
if (loadVideoStarted) {
|
||||||
loadVideoStarted = false;
|
loadVideoStarted = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user