Chore/fix strange management of resume (#3629)
* fix(android): rename startPlayback to resumePlayback and fix implementation I cannot understand why this implementation has been done. I guess this is to workaround some issue... now resume only resume playback and don't start a new playback during bufffering... * chore: simplify duplicated code
This commit is contained in:
parent
75d370742b
commit
dd3a400689
@ -357,8 +357,7 @@ public class ReactExoplayerView extends FrameLayout implements
|
||||
|
||||
@Override
|
||||
public void onHostDestroy() {
|
||||
stopPlayback();
|
||||
themedReactContext.removeLifecycleEventListener(this);
|
||||
cleanUpResources();
|
||||
}
|
||||
|
||||
public void cleanUpResources() {
|
||||
@ -998,27 +997,14 @@ public class ReactExoplayerView extends FrameLayout implements
|
||||
}
|
||||
}
|
||||
|
||||
private void startPlayback() {
|
||||
private void resumePlayback() {
|
||||
if (player != null) {
|
||||
switch (player.getPlaybackState()) {
|
||||
case Player.STATE_IDLE:
|
||||
case Player.STATE_ENDED:
|
||||
initializePlayer();
|
||||
break;
|
||||
case Player.STATE_BUFFERING:
|
||||
case Player.STATE_READY:
|
||||
if (!player.getPlayWhenReady()) {
|
||||
setPlayWhenReady(true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
initializePlayer();
|
||||
}
|
||||
setKeepScreenOn(preventsDisplaySleepDuringVideoPlayback);
|
||||
}
|
||||
}
|
||||
|
||||
private void pausePlayback() {
|
||||
if (player != null) {
|
||||
@ -1850,7 +1836,7 @@ public class ReactExoplayerView extends FrameLayout implements
|
||||
isPaused = paused;
|
||||
if (player != null) {
|
||||
if (!paused) {
|
||||
startPlayback();
|
||||
resumePlayback();
|
||||
} else {
|
||||
pausePlayback();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user