ExoPlayer 全屏旋转

ExoPlayer rotate in FullScreen

我想在设备旋转时旋转我的播放器。 我用它来让我的播放器全屏显示

 getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN
                                                                |View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                                                                |View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

我尝试 setRotation(90) 但我的视野从角落变小了! 当我尝试改变我的设备方向以制作全屏时,玩家首先绘制一半视图,然后进入正常的全屏模式[!

我自己找到了答案,这是 ReactExoPlayerView 的全屏集成

private void openFullscreenDialog() {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
        ((ViewGroup) exoPlayerView.getParent()).removeView(exoPlayerView);
        if (playerControlView.getParent() != null) {
            ((ViewGroup) playerControlView.getParent()).removeView(playerControlView); // <- fix
        }
        exoPlayerView.addView(playerControlView);
        mFullScreenDialog = new Dialog(themedReactContext, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
        mFullScreenDialog.addContentView(exoPlayerView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        mFullScreenDialog.setCancelable(false);
        mFullScreenDialog.setOnKeyListener((dialog, keyCode, event) -> {
            if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
                if (isFullscreen) {
                    fullScreenButtonClick();
                }
                return true;
            } else {
                return false;

            }
        });
        mFullScreenDialog.show();
    }

private void closeFullscreenDialog() {
          activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        ((ViewGroup) exoPlayerView.getParent()).removeView(exoPlayerView);
        if (playerControlView.getParent() != null) {
            ((ViewGroup) playerControlView.getParent()).removeView(playerControlView); // <- fix
        }
        addView(exoPlayerView);
        setControls(true);
        mFullScreenDialog.dismiss();
    }

希望对大家有所帮助