mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
Don't show subtitles until player presentation is ready
This commit is contained in:
parent
5db6d2c901
commit
30f96e2c58
1 changed files with 9 additions and 9 deletions
|
|
@ -45,7 +45,7 @@ import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.RectangleShape
|
import androidx.compose.ui.graphics.RectangleShape
|
||||||
import androidx.compose.ui.input.key.onKeyEvent
|
import androidx.compose.ui.input.key.onKeyEvent
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
import androidx.compose.ui.layout.onGloballyPositioned
|
import androidx.compose.ui.layout.onSizeChanged
|
||||||
import androidx.compose.ui.platform.LocalConfiguration
|
import androidx.compose.ui.platform.LocalConfiguration
|
||||||
import androidx.compose.ui.platform.LocalDensity
|
import androidx.compose.ui.platform.LocalDensity
|
||||||
import androidx.compose.ui.text.intl.Locale
|
import androidx.compose.ui.text.intl.Locale
|
||||||
|
|
@ -327,13 +327,13 @@ fun PlaybackPageContent(
|
||||||
.focusRequester(focusRequester)
|
.focusRequester(focusRequester)
|
||||||
.focusable(),
|
.focusable(),
|
||||||
) {
|
) {
|
||||||
var playerSize by remember { mutableStateOf(IntSize.Zero) }
|
var playerSurfaceSize by remember { mutableStateOf(IntSize.Zero) }
|
||||||
PlayerSurface(
|
PlayerSurface(
|
||||||
player = player,
|
player = player,
|
||||||
surfaceType = SURFACE_TYPE_SURFACE_VIEW,
|
surfaceType = SURFACE_TYPE_SURFACE_VIEW,
|
||||||
modifier =
|
modifier =
|
||||||
scaledModifier.onGloballyPositioned {
|
scaledModifier.onSizeChanged {
|
||||||
playerSize = it.size
|
playerSurfaceSize = it
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if (presentationState.coverSurface) {
|
if (presentationState.coverSurface) {
|
||||||
|
|
@ -427,7 +427,7 @@ fun PlaybackPageContent(
|
||||||
remember(subtitleSettings) { subtitleSettings.imageSubtitleOpacity / 100f }
|
remember(subtitleSettings) { subtitleSettings.imageSubtitleOpacity / 100f }
|
||||||
|
|
||||||
// Subtitles
|
// Subtitles
|
||||||
if (skipIndicatorDuration == 0L && currentItemPlayback.subtitleIndexEnabled) {
|
if (skipIndicatorDuration == 0L && currentItemPlayback.subtitleIndexEnabled && !presentationState.coverSurface) {
|
||||||
val maxSize by animateFloatAsState(if (controllerViewState.controlsVisible) .7f else 1f)
|
val maxSize by animateFloatAsState(if (controllerViewState.controlsVisible) .7f else 1f)
|
||||||
val isImageSubtitles = remember(cues) { cues.firstOrNull()?.bitmap != null }
|
val isImageSubtitles = remember(cues) { cues.firstOrNull()?.bitmap != null }
|
||||||
AndroidView(
|
AndroidView(
|
||||||
|
|
@ -462,14 +462,14 @@ fun PlaybackPageContent(
|
||||||
it.children.firstOrNull { it is AssSubtitleView }?.let {
|
it.children.firstOrNull { it is AssSubtitleView }?.let {
|
||||||
(it as? AssSubtitleView)?.apply {
|
(it as? AssSubtitleView)?.apply {
|
||||||
val resized =
|
val resized =
|
||||||
layoutParams.let { it.width != playerSize.width || it.height != playerSize.height }
|
layoutParams.let { it.width != playerSurfaceSize.width || it.height != playerSurfaceSize.height }
|
||||||
if (resized) {
|
if (resized) {
|
||||||
Timber.v("Resizing AssSubtitleView: $playerSize")
|
Timber.v("Resizing AssSubtitleView: $playerSurfaceSize")
|
||||||
layoutParams =
|
layoutParams =
|
||||||
FrameLayout
|
FrameLayout
|
||||||
.LayoutParams(
|
.LayoutParams(
|
||||||
playerSize.width,
|
playerSurfaceSize.width,
|
||||||
playerSize.height,
|
playerSurfaceSize.height,
|
||||||
).apply { gravity = Gravity.CENTER }
|
).apply { gravity = Gravity.CENTER }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue