mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
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:
parent
aeaecc0f59
commit
abf5ec8004
1 changed files with 8 additions and 5 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue