簡體   English   中英

Exo PlayerView 第一幀拉伸到全屏

[英]Exo PlayerView first frame stretch to full screen

在此處輸入圖像描述

我使用PlayerView播放 mp4 視頻文件,但第一幀總是拉伸到全屏。 我們怎樣才能避免呢? 這是我配置PlayerPlayerView的代碼

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

        video_view.player = player

我在 StyledPlayerView 標簽中有android:animateLayoutChanges="true"導致問題,刪除它。 還要確保父視圖沒有animateLayoutChanges屬性
這是完整的 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