Skip to content

Commit

Permalink
feat: add pipFullscreenPlayerView for makes PIP include video only
Browse files Browse the repository at this point in the history
  • Loading branch information
YangJonghun committed Jan 19, 2024
1 parent 0c06c2f commit f3066a4
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public class ReactExoplayerView extends FrameLayout implements

private ExoPlayerView exoPlayerView;
private FullScreenPlayerView fullScreenPlayerView;
private FullScreenPlayerView pipFullScreenPlayerView;
private ImaAdsLoader adsLoader;

private DataSource.Factory mediaDataSourceFactory;
Expand Down Expand Up @@ -1886,6 +1887,32 @@ public void setPictureInPicture(boolean pictureInPictureEnabled) {
protected void setIsInPictureInPicture(boolean isInPictureInPicture) {
this.isInPictureInPicture = isInPictureInPicture;
eventEmitter.onPictureInPictureStatusChanged(isInPictureInPicture);
if (isInPictureInPicture) {
if (fullScreenPlayerView != null && fullScreenPlayerView.isShowing()) {
fullScreenPlayerView.dismiss();
}
if (pipFullScreenPlayerView == null) {
pipFullScreenPlayerView = new FullScreenPlayerView(getContext(), exoPlayerView, null, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() { }
});
}
pipFullScreenPlayerView.show();
} else {
if (pipFullScreenPlayerView != null && pipFullScreenPlayerView.isShowing()) {
pipFullScreenPlayerView.dismiss();
}
if (controls) {
fullScreenPlayerView = new FullScreenPlayerView(getContext(), exoPlayerView, playerControlView, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
setFullscreen(false);
}
});
fullScreenPlayerView.show();
updateFullScreenButtonVisbility();
}
}
}

private void updatePictureInPictureActions(boolean isPaused) {
Expand Down

0 comments on commit f3066a4

Please sign in to comment.