Заставить видео занять всю ширину SImpleExoPlayerView - PullRequest
0 голосов
/ 11 мая 2018

У меня проблемы с принудительным размещением видео на всю ширину 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);

1 Ответ

0 голосов
/ 17 мая 2018

Мне пришлось вручную сбросить 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>
...