get foo working again

This commit is contained in:
Christian Schabesberger 2024-07-22 20:46:18 +02:00
parent 8bed5b701d
commit 5ee7398f64
2 changed files with 2 additions and 4 deletions

View File

@ -58,7 +58,7 @@ data class VideoPlayerUIState(
playing = false, playing = false,
fullscreen = false, fullscreen = false,
uiVisible = false, uiVisible = false,
contentRatio = 0F, contentRatio = 16 / 9F,
uiRatio = 16F / 9F, uiRatio = 16F / 9F,
contentFitMode = ContentFitMode.FIT_INSIDE contentFitMode = ContentFitMode.FIT_INSIDE
) )
@ -137,7 +137,6 @@ class VideoPlayerViewModelImpl @Inject constructor(
override fun onIsPlayingChanged(isPlaying: Boolean) { override fun onIsPlayingChanged(isPlaying: Boolean) {
super.onIsPlayingChanged(isPlaying) super.onIsPlayingChanged(isPlaying)
Log.d(TAG, "Playing state changed. Is Playing: $isPlaying") Log.d(TAG, "Playing state changed. Is Playing: $isPlaying")
Log.d(TAG, "Gurken: ${VideoSize.fromMedia3VideoSize(player.videoSize)}")
mutableUiState.update { mutableUiState.update {
it.copy(playing = isPlaying) it.copy(playing = isPlaying)
} }
@ -145,7 +144,6 @@ class VideoPlayerViewModelImpl @Inject constructor(
override fun onVideoSizeChanged(videoSize: androidx.media3.common.VideoSize) { override fun onVideoSizeChanged(videoSize: androidx.media3.common.VideoSize) {
super.onVideoSizeChanged(videoSize) super.onVideoSizeChanged(videoSize)
println("gurken aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
updateContentRatio(VideoSize.fromMedia3VideoSize(videoSize)) updateContentRatio(VideoSize.fromMedia3VideoSize(videoSize))
} }
}) })

View File

@ -56,7 +56,7 @@ fun VideoPlayerUI(
) { ) {
if (viewModel == null) { if (viewModel == null) {
VideoPlayerLoadingPlaceholder() VideoPlayerLoadingPlaceholder()
} else if (viewModel.player == null || viewModel.uiState.collectAsState().value.contentRatio == 0.0F) { } else if (viewModel.player == null) {
VideoPlayerLoadingPlaceholder(viewModel.uiState.collectAsState().value.uiRatio) VideoPlayerLoadingPlaceholder(viewModel.uiState.collectAsState().value.uiRatio)
} else { } else {
val uiState by viewModel.uiState.collectAsState() val uiState by viewModel.uiState.collectAsState()