fix: hiding of controls while scrubbing is active

fixes #1100
This commit is contained in:
tapframe 2026-05-17 19:19:38 +05:30
parent 247a4f4122
commit 7a5c531a24

View file

@ -228,6 +228,7 @@ fun PlayerScreen(
val keepScreenAwake = errorMessage == null && val keepScreenAwake = errorMessage == null &&
(playbackSnapshot.isPlaying || (shouldPlay && playbackSnapshot.isLoading)) (playbackSnapshot.isPlaying || (shouldPlay && playbackSnapshot.isLoading))
EnterImmersivePlayerMode(keepScreenAwake = keepScreenAwake) EnterImmersivePlayerMode(keepScreenAwake = keepScreenAwake)
var isScrubbingTimeline by remember { mutableStateOf(false) }
var scrubbingPositionMs by remember { mutableStateOf<Long?>(null) } var scrubbingPositionMs by remember { mutableStateOf<Long?>(null) }
var pausedOverlayVisible by remember { mutableStateOf(false) } var pausedOverlayVisible by remember { mutableStateOf(false) }
var gestureFeedback by remember { mutableStateOf<GestureFeedbackState?>(null) } var gestureFeedback by remember { mutableStateOf<GestureFeedbackState?>(null) }
@ -600,6 +601,7 @@ fun PlayerScreen(
controlsVisible = false controlsVisible = false
lockedOverlayVisible = false lockedOverlayVisible = false
pausedOverlayVisible = false pausedOverlayVisible = false
isScrubbingTimeline = false
scrubbingPositionMs = null scrubbingPositionMs = null
gestureMessageJob?.cancel() gestureMessageJob?.cancel()
gestureFeedback = null gestureFeedback = null
@ -1228,6 +1230,7 @@ fun PlayerScreen(
playerController = null playerController = null
playerControllerSourceUrl = null playerControllerSourceUrl = null
playbackSnapshot = PlayerPlaybackSnapshot() playbackSnapshot = PlayerPlaybackSnapshot()
isScrubbingTimeline = false
scrubbingPositionMs = null scrubbingPositionMs = null
liveGestureFeedback = null liveGestureFeedback = null
renderedGestureFeedback = null renderedGestureFeedback = null
@ -1325,8 +1328,22 @@ fun PlayerScreen(
initialSeekApplied = true initialSeekApplied = true
} }
LaunchedEffect(controlsVisible, playbackSnapshot.isPlaying, playbackSnapshot.isLoading, showParentalGuide, errorMessage) { LaunchedEffect(
if (!controlsVisible || !playbackSnapshot.isPlaying || playbackSnapshot.isLoading || showParentalGuide || errorMessage != null) { controlsVisible,
isScrubbingTimeline,
playbackSnapshot.isPlaying,
playbackSnapshot.isLoading,
showParentalGuide,
errorMessage,
) {
if (
!controlsVisible ||
isScrubbingTimeline ||
!playbackSnapshot.isPlaying ||
playbackSnapshot.isLoading ||
showParentalGuide ||
errorMessage != null
) {
return@LaunchedEffect return@LaunchedEffect
} }
delay(3500) delay(3500)
@ -1794,8 +1811,12 @@ fun PlayerScreen(
parentalWarnings = parentalWarnings, parentalWarnings = parentalWarnings,
showParentalGuide = showParentalGuide, showParentalGuide = showParentalGuide,
onParentalGuideAnimationComplete = { showParentalGuide = false }, onParentalGuideAnimationComplete = { showParentalGuide = false },
onScrubChange = { positionMs -> scrubbingPositionMs = positionMs }, onScrubChange = { positionMs ->
isScrubbingTimeline = true
scrubbingPositionMs = positionMs
},
onScrubFinished = { positionMs -> onScrubFinished = { positionMs ->
isScrubbingTimeline = false
scrubbingPositionMs = null scrubbingPositionMs = null
playerController?.seekTo(positionMs) playerController?.seekTo(positionMs)
}, },