【问题标题】:Forcing video to take up entire width of SImpleExoPlayerView强制视频占据整个 SIMpleExoPlayerView 的宽度
【发布时间】:2018-05-11 02:58:14
【问题描述】:

我无法将视频强制为 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);

【问题讨论】:

    标签: android android-layout logic media-player exoplayer


    【解决方案1】:

    我不得不手动重置 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>
    

    【讨论】:

      猜你喜欢
      • 2020-11-04
      • 1970-01-01
      • 2022-10-06
      • 1970-01-01
      • 2013-01-01
      • 2021-01-30
      • 2013-08-28
      • 1970-01-01
      • 2015-03-14
      相关资源
      最近更新 更多