How to hide control buttons in ExoPlayer2

ExoPlayer-r2.2.0 used

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

or

app:use_controller="false" in Layout

<...
    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"/>

Simply use this

exoPlayerView.setUseController(false);

Kotlin:

exoPlayerView.useController = false

Java:

exoPlayerView.setUseController(false);

XML:

app:use_controller="false"

Documentation: https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/ui/PlayerView.html#setUseController-boolean-


exoPlayerView.setUseController(false);