Remove the scaling added in Player.Listener.onVideoSizeChanged (#5055)

This commit is contained in:
Jorge Martin Espinosa 2025-07-22 16:06:49 +02:00 committed by GitHub
parent 8947757c4c
commit 399c52bf1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,7 +25,6 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.viewinterop.AndroidView
@ -34,7 +33,6 @@ import androidx.media3.common.MediaItem
import androidx.media3.common.Player
import androidx.media3.common.Player.STATE_READY
import androidx.media3.common.Timeline
import androidx.media3.common.VideoSize
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.ui.AspectRatioFrameLayout
import androidx.media3.ui.PlayerView
@ -56,7 +54,6 @@ import io.element.android.libraries.mediaviewer.impl.local.player.seekToEnsurePl
import io.element.android.libraries.mediaviewer.impl.local.player.togglePlay
import io.element.android.libraries.mediaviewer.impl.local.rememberLocalMediaViewState
import kotlinx.coroutines.delay
import me.saket.telephoto.zoomable.ZoomableContentLocation
import me.saket.telephoto.zoomable.zoomable
import kotlin.time.Duration.Companion.seconds
@ -154,18 +151,6 @@ private fun ExoPlayerMediaVideoView(
isReady = playbackState == STATE_READY,
)
}
override fun onVideoSizeChanged(videoSize: VideoSize) {
// Ensure that the user cannot zoom/move outside of the video bounds
localMediaViewState.zoomableState.setContentLocation(
ZoomableContentLocation.scaledInsideAndCenterAligned(
Size(
videoSize.width.toFloat(),
videoSize.height.toFloat(),
)
)
)
}
}
}