Show subtitles even when controller is visible (#28)

Closes #20 

Show subtitles slightly smaller and higher when the controls are visible

This needs to be revisited when custom subtitle styling is implemented
(#11).
This commit is contained in:
damontecres 2025-10-17 18:55:54 -04:00 committed by GitHub
parent e0772ed9b8
commit 7f93262d06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -260,6 +260,30 @@ fun PlaybackPage(
}
}
// Subtitles
if (skipIndicatorDuration == 0L && currentItemPlayback.subtitleIndexEnabled) {
val maxSize by animateFloatAsState(if (controllerViewState.controlsVisible) .7f else 1f)
AndroidView(
factory = { context ->
SubtitleView(context).apply {
setUserDefaultStyle()
setUserDefaultTextSize()
}
},
update = {
it.setCues(cues)
},
onReset = {
it.setCues(null)
},
modifier =
Modifier
.fillMaxSize(maxSize)
.align(Alignment.TopCenter)
.background(Color.Transparent),
)
}
// The playback controls
AnimatedVisibility(
controllerViewState.controlsVisible,
@ -343,28 +367,6 @@ fun PlaybackPage(
)
}
// Subtitles
if (!controllerViewState.controlsVisible && skipIndicatorDuration == 0L && currentItemPlayback.subtitleIndexEnabled) {
AndroidView(
factory = { context ->
SubtitleView(context).apply {
setUserDefaultStyle()
setUserDefaultTextSize()
}
},
update = {
it.setCues(cues)
},
onReset = {
it.setCues(null)
},
modifier =
Modifier
.fillMaxSize()
.background(Color.Transparent),
)
}
// Ask to skip intros, etc button
AnimatedVisibility(
showSegment,