当景观模式播放肖像视频时,接下来的按钮和以前的按钮被隐藏
我的应用程序的一部分显示了手机中的视频并提供视频播放功能。这是系层布局实现。
<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>
一切正常,除了自动座架打开并且在肖像模式下拍摄的视频时,在景观模式下,未显示下一个和以前的按钮。
这样:
在肖像模式下,我们可以看到所有用户控制器按钮,例如:
我知道没有空间容纳所有按钮,所以我想在整个屏幕上扩展控件。但是我无法做到。
我尝试实现自定义播放器,例如 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);
它根本不会显示任何控制按钮。
有什么想法如何使用户控制器在屏幕上伸展并显示肖像视频以景观模式播放的控制器的所有按钮?提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论