VEX-6625: Handle state to keep playing after gaining connection (#28)

This PR handles autoplay after disconnection

Jira: VEX-6625

There was an error in react-native-video not being properly handled, in addition, the state of the player when reconnecting using a free user was not the expected one, requesting the player to keep playing when ready, made the behavior consistent in all scenarios

Velocity PR: crunchyroll/velocity#2430

Reviews
Major reviewer (domain expert): @jctorresM
Minor reviewer: @jacob-livingston
This commit is contained in:
Gabriel Rivero 2022-05-03 16:43:53 -04:00 committed by GitHub
parent b274541431
commit 9035e7dfc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -817,7 +817,6 @@ class ReactExoplayerView extends FrameLayout implements
case Player.STATE_IDLE:
case Player.STATE_ENDED:
initializePlayer();
break;
case Player.STATE_BUFFERING:
case Player.STATE_READY:
if (!player.getPlayWhenReady()) {
@ -827,7 +826,6 @@ class ReactExoplayerView extends FrameLayout implements
default:
break;
}
} else {
initializePlayer();
}
@ -1314,6 +1312,12 @@ class ReactExoplayerView extends FrameLayout implements
setPlayWhenReady(true);
return;
}
} else if (cause instanceof HttpDataSource.HttpDataSourceException) {
// this exception happens when connectivity is lost
updateResumePosition();
initializePlayer();
setPlayWhenReady(true);
return;
} else {
errorCode = "2021";
errorString = getResources().getString(R.string.unrecognized_media_format);