From abf5ec8004facf4ce688af1e94c8e7e42526416d Mon Sep 17 00:00:00 2001 From: Ray <154766448+damontecres@users.noreply.github.com> Date: Sat, 7 Feb 2026 13:03:10 -0500 Subject: [PATCH] Take playback speed into account when calculating the video end time (#843) ## Description Small change so that the "Ends" time on the playback overlay takes the current playback speed into account. ### Related issues Closes #836 ### Testing Emulator ## Screenshots N/A ## AI or LLM usage None --- .../wholphin/ui/playback/PlaybackOverlay.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/playback/PlaybackOverlay.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/playback/PlaybackOverlay.kt index 99313af2..ac6aaeed 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/playback/PlaybackOverlay.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/playback/PlaybackOverlay.kt @@ -555,16 +555,19 @@ fun Controller( ) } if (showClock) { - var remaining by remember { mutableStateOf((playerControls.duration - playerControls.currentPosition).milliseconds) } + var endTimeStr by remember { mutableStateOf("...") } LaunchedEffect(playerControls) { while (isActive) { - remaining = - (playerControls.duration - playerControls.currentPosition).milliseconds + val remaining = + (playerControls.duration - playerControls.currentPosition) + .div(playerControls.playbackParameters.speed) + .toLong() + .milliseconds + val endTime = LocalTime.now().plusSeconds(remaining.inWholeSeconds) + endTimeStr = TimeFormatter.format(endTime) delay(1.seconds) } } - val endTime = LocalTime.now().plusSeconds(remaining.inWholeSeconds) - val endTimeStr = TimeFormatter.format(endTime) Text( text = "Ends $endTimeStr", color = MaterialTheme.colorScheme.onSurface,