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
This commit is contained in:
Ray 2026-02-07 13:03:10 -05:00 committed by GitHub
parent aeaecc0f59
commit abf5ec8004
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -555,16 +555,19 @@ fun Controller(
) )
} }
if (showClock) { if (showClock) {
var remaining by remember { mutableStateOf((playerControls.duration - playerControls.currentPosition).milliseconds) } var endTimeStr by remember { mutableStateOf("...") }
LaunchedEffect(playerControls) { LaunchedEffect(playerControls) {
while (isActive) { while (isActive) {
remaining = val remaining =
(playerControls.duration - playerControls.currentPosition).milliseconds (playerControls.duration - playerControls.currentPosition)
.div(playerControls.playbackParameters.speed)
.toLong()
.milliseconds
val endTime = LocalTime.now().plusSeconds(remaining.inWholeSeconds)
endTimeStr = TimeFormatter.format(endTime)
delay(1.seconds) delay(1.seconds)
} }
} }
val endTime = LocalTime.now().plusSeconds(remaining.inWholeSeconds)
val endTimeStr = TimeFormatter.format(endTime)
Text( Text(
text = "Ends $endTimeStr", text = "Ends $endTimeStr",
color = MaterialTheme.colorScheme.onSurface, color = MaterialTheme.colorScheme.onSurface,