do not hide fullscreen in stopPlayback
This commit is contained in:
parent
5fe76574bb
commit
0aa9a5901e
@ -60,9 +60,8 @@ public class ExoPlayerFullscreenVideoActivity extends AppCompatActivity implemen
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
boolean isPaused = ReactExoplayerView.getViewInstance(id).isPaused();
|
||||
player.setPlayWhenReady(!isPaused);
|
||||
if (ReactExoplayerView.getViewInstance(id) != null) {
|
||||
ReactExoplayerView.getViewInstance(id).syncPlayerState();
|
||||
ReactExoplayerView.getViewInstance(id).registerFullScreenDelegate(this);
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ class ReactExoplayerView extends FrameLayout implements
|
||||
private boolean isFullscreen;
|
||||
private String fullScreenOrientation;
|
||||
private boolean isInBackground;
|
||||
private boolean isInFullscreen;
|
||||
private boolean isPaused;
|
||||
private boolean isBuffering;
|
||||
private boolean muted = false;
|
||||
@ -241,11 +242,14 @@ class ReactExoplayerView extends FrameLayout implements
|
||||
@Override
|
||||
public void onHostResume() {
|
||||
if (!playInBackground || !isInBackground) {
|
||||
if (player != null) {
|
||||
exoPlayerView.setPlayer(player);
|
||||
boolean temp = this.disableFocus;
|
||||
player.setPlayWhenReady(!isPaused);
|
||||
this.disableFocus = temp;
|
||||
if (isInFullscreen) {
|
||||
if (player != null) {
|
||||
exoPlayerView.setPlayer(player);
|
||||
syncPlayerState();
|
||||
}
|
||||
isInFullscreen = false;
|
||||
} else {
|
||||
setPlayWhenReady(!isPaused);
|
||||
}
|
||||
}
|
||||
isInBackground = false;
|
||||
@ -294,8 +298,15 @@ class ReactExoplayerView extends FrameLayout implements
|
||||
return player;
|
||||
}
|
||||
|
||||
public boolean isPaused() {
|
||||
return isPaused;
|
||||
public void syncPlayerState() {
|
||||
if (player == null) return;
|
||||
if (player.getPlaybackState() == Player.STATE_ENDED) {
|
||||
// Try to get last frame displayed
|
||||
player.seekTo(player.getDuration() - 200);
|
||||
player.setPlayWhenReady(true);
|
||||
} else {
|
||||
player.setPlayWhenReady(!isPaused);
|
||||
}
|
||||
}
|
||||
|
||||
public void registerFullScreenDelegate(FullScreenDelegate delegate) {
|
||||
@ -323,6 +334,7 @@ class ReactExoplayerView extends FrameLayout implements
|
||||
intent.putExtra(ExoPlayerFullscreenVideoActivity.EXTRA_ID, this.uid);
|
||||
intent.putExtra(ExoPlayerFullscreenVideoActivity.EXTRA_ORIENTATION, this.fullScreenOrientation);
|
||||
getContext().startActivity(intent);
|
||||
isInFullscreen = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -623,9 +635,6 @@ class ReactExoplayerView extends FrameLayout implements
|
||||
}
|
||||
|
||||
private void onStopPlayback() {
|
||||
if (isFullscreen) {
|
||||
setFullscreen(false);
|
||||
}
|
||||
audioManager.abandonAudioFocus(this);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user