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
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
boolean isPaused = ReactExoplayerView.getViewInstance(id).isPaused();
|
|
||||||
player.setPlayWhenReady(!isPaused);
|
|
||||||
if (ReactExoplayerView.getViewInstance(id) != null) {
|
if (ReactExoplayerView.getViewInstance(id) != null) {
|
||||||
|
ReactExoplayerView.getViewInstance(id).syncPlayerState();
|
||||||
ReactExoplayerView.getViewInstance(id).registerFullScreenDelegate(this);
|
ReactExoplayerView.getViewInstance(id).registerFullScreenDelegate(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,7 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
private boolean isFullscreen;
|
private boolean isFullscreen;
|
||||||
private String fullScreenOrientation;
|
private String fullScreenOrientation;
|
||||||
private boolean isInBackground;
|
private boolean isInBackground;
|
||||||
|
private boolean isInFullscreen;
|
||||||
private boolean isPaused;
|
private boolean isPaused;
|
||||||
private boolean isBuffering;
|
private boolean isBuffering;
|
||||||
private boolean muted = false;
|
private boolean muted = false;
|
||||||
@ -241,11 +242,14 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
@Override
|
@Override
|
||||||
public void onHostResume() {
|
public void onHostResume() {
|
||||||
if (!playInBackground || !isInBackground) {
|
if (!playInBackground || !isInBackground) {
|
||||||
if (player != null) {
|
if (isInFullscreen) {
|
||||||
exoPlayerView.setPlayer(player);
|
if (player != null) {
|
||||||
boolean temp = this.disableFocus;
|
exoPlayerView.setPlayer(player);
|
||||||
player.setPlayWhenReady(!isPaused);
|
syncPlayerState();
|
||||||
this.disableFocus = temp;
|
}
|
||||||
|
isInFullscreen = false;
|
||||||
|
} else {
|
||||||
|
setPlayWhenReady(!isPaused);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isInBackground = false;
|
isInBackground = false;
|
||||||
@ -294,8 +298,15 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPaused() {
|
public void syncPlayerState() {
|
||||||
return isPaused;
|
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) {
|
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_ID, this.uid);
|
||||||
intent.putExtra(ExoPlayerFullscreenVideoActivity.EXTRA_ORIENTATION, this.fullScreenOrientation);
|
intent.putExtra(ExoPlayerFullscreenVideoActivity.EXTRA_ORIENTATION, this.fullScreenOrientation);
|
||||||
getContext().startActivity(intent);
|
getContext().startActivity(intent);
|
||||||
|
isInFullscreen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -623,9 +635,6 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onStopPlayback() {
|
private void onStopPlayback() {
|
||||||
if (isFullscreen) {
|
|
||||||
setFullscreen(false);
|
|
||||||
}
|
|
||||||
audioManager.abandonAudioFocus(this);
|
audioManager.abandonAudioFocus(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user