A part of my app shows the videos in the phone and provides video playing functionality. This is the exoplayer layout implementation.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".view.activity.ExoplayerActivity"
android:gravity="center"
android:background="@android:color/black">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/videoFullScreenPlayer"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rewind_increment="10000"
app:fastforward_increment="10000"
app:use_sensor_rotation="true"
android:focusable="true"
app:auto_show="true"
app:use_controller="true"
app:resize_mode="fill">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/video_FL"
android:background="@color/transparent">
<ImageView
android:layout_width="23dp"
android:layout_height="23dp"
android:id="@+id/backBtn_IV"
android:src="@drawable/ic_back_longtail"
android:tint="@color/white"
android:layout_marginLeft="10dp"
android:layout_gravity="start|center_vertical"/>
</FrameLayout>
</com.google.android.exoplayer2.ui.PlayerView>
</RelativeLayout>
Everything works fine, except that when autorotate is on and a video which is taken in portrait mode is played in landscape mode, the NEXT and PREVIOUS buttons are not shown.
Like this:
On portrait mode, we can see all the user controller buttons, like this:
I understand there isn't space to accommodate all the buttons, so I wanted to stretch the controls across the entire screen. But I am not able to do it.
I tried implementing custom Player like this. And I tried to stretch the controls across the screen like this:
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int screenWidth = displayMetrics.widthPixels;
LinearLayout controls = findViewById(R.id.controls);
ViewGroup.LayoutParams controlLayout = controls.getLayoutParams();
controlLayout.width = screenWidth;
controls.setLayoutParams(controlLayout);
It would not show any of the control buttons at all.
Any idea how to get the user controller to stretch across the screen and show all the buttons of the controller when a portrait video is played in landscape mode? Thanks in advance.