强制视频占据 SImpleExoPlayerView 的整个宽度
Forcing video to take up entire width of SImpleExoPlayerView
我无法强制视频成为 SimpleExoPlayerView
的整个宽度。我已经阅读了几篇堆栈溢出帖子,但没有成功。布局:
<FrameLayout
android:id="@+id/video_framelayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.exoplayer2.ui.SimpleExoPlayerView
android:id="@+id/post_videoView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</FrameLayout>
我还尝试使用以下 java 代码:
postVideoView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL);
postVideoView.getPlayer().setVideoScalingMode(MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
我不得不手动重置 resize_mode:
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout
android:id="@+id/video_framelayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.exoplayer2.ui.SimpleExoPlayerView
android:id="@+id/post_videoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:resize_mode="fixed_width"/>
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
我无法强制视频成为 SimpleExoPlayerView
的整个宽度。我已经阅读了几篇堆栈溢出帖子,但没有成功。布局:
<FrameLayout
android:id="@+id/video_framelayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.exoplayer2.ui.SimpleExoPlayerView
android:id="@+id/post_videoView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</FrameLayout>
我还尝试使用以下 java 代码:
postVideoView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL);
postVideoView.getPlayer().setVideoScalingMode(MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
我不得不手动重置 resize_mode:
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout
android:id="@+id/video_framelayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.exoplayer2.ui.SimpleExoPlayerView
android:id="@+id/post_videoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:resize_mode="fixed_width"/>
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>