Search code examples
androidexoplayerexoplayer2.xexoplayer-media-item

Exoplayer video zooms in after seeking


I'm using the exoplayer to play an hls stream. When it loads initially it looks fine, but after calling seekBack, seekForward, or seekTo, the video scaling seems to stop working correctly.

Before: enter image description here After: enter image description here

XML:

        <com.google.android.exoplayer2.ui.PlayerView
            android:id="@+id/exoPlayer"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:resize_mode="fit"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:use_controller="false"/>

Initialization:

    init {
        exoPlayer = ExoPlayer.Builder(context).build()
        exoPlayer.videoScalingMode = C.VIDEO_SCALING_MODE_SCALE_TO_FIT
        exoPlayer.addListener(this)
    }

I'm using exoplayer version 2.18.3

I've tried all the different scaling modes, none seem to fix this.


Solution

  • Updating to 2.18.4 resolved this issue