简体   繁体   English

Exo PlayerView 第一帧拉伸到全屏

[英]Exo PlayerView first frame stretch to full screen

在此处输入图像描述

I use PlayerView to play mp4 video file, but the first frame always stretch to full screen.我使用PlayerView播放 mp4 视频文件,但第一帧总是拉伸到全屏。 How can we avoid that?我们怎样才能避免呢? This is code I config Player and PlayerView这是我配置PlayerPlayerView的代码

        player = SimpleExoPlayer.Builder(requireContext()).build().apply {
            playWhenReady = this@VideoPlayerFragment.playWhenReady
            seekTo(currentWindow, playbackPosition)
            setMediaSource(mediaSource, false)
            prepare()
        }

        video_view.player = player

i had android:animateLayoutChanges="true" in StyledPlayerView tag which caused the problem, remove it.我在 StyledPlayerView 标签中有android:animateLayoutChanges="true"导致问题,删除它。 also make sure parent view doesn't have animateLayoutChanges attribute还要确保父视图没有animateLayoutChanges属性
here is the full exoplayer xml这是完整的 exoplayer xml

<com.google.android.exoplayer2.ui.StyledPlayerView
    android:id="@+id/video_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:animation_enabled="false"
    app:auto_show="true"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:repeat_toggle_modes="none"
    app:resize_mode="fit"
    app:show_timeout="3000"
    app:surface_type="texture_view"
    app:use_controller="true" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM