Search code examples
androidexoplayerexoplayer2.x

Exoplayer - Change the size of exo_playback_control_view controller at runtime programmatically


I've overwritten the XML layout of exo_playback_control_view to a custom one that I have.

enter image description here

Right now I am using the PlayerView

<com.google.android.exoplayer2.ui.PlayerView
        android:id="@+id/vh_videoviewholder_playerview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

At runtime I have a button, and I want to change the size of controller view on that button click. Exoplayer automatically uses the view exo_playback_control_view.xml (I don't need to use findviewbyid) so I am unsure how I am suppose to manipulate the controller view.

Edit: How to get reference to the controller view?


Solution

  • To get reference to the player's ControlView you need to get reference to the PlayerView first.

    PlayerView playerView = findViewById(R.id.player_view);

    then using the playerView, you can get reference to any of the buttons/layout items using:

    playerControlLayout = playerView.findViewById(R.id.player_control_layout);