如何隐藏ExoPlayer2中所有不存在的 Controller (开始按钮,暂停等),并且它们始终处于满屏状态。

我看了看,有simpleExoPlayerView.setUseController(true)方法;

但这会停用播放器...

public void setUseController (boolean useController) {
    this.useController = useController;
if (useController) {
      controller.setPlayer(player);
    } else {
      controller.hide();
      controller.setPlayer(null);
    }
}

如何隐藏或删除这些组件?

最佳答案

使用了ExoPlayer-r2.2.0

videoView.hideController();
videoView.setControllerVisibilityListener(new PlaybackControlView.VisibilityListener() {
    @Override
    public void onVisibilityChange(int i) {
        if(i == 0) {
            videoView.hideController();
        }
    }
});

或者

app:use_controller =“false”在布局中
<...
    xmlns:app="http://schemas.android.com/apk/res-auto"
    ...>

    <com.google.android.exoplayer2.ui.SimpleExoPlayerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:use_controller="false"/>

10-04 23:00