fix: endsAt to calculate time based on playback speed
This commit is contained in:
parent
655a62f5ee
commit
8e055575f0
1 changed files with 7 additions and 3 deletions
|
|
@ -865,7 +865,8 @@ fun PlayerScreen(
|
|||
) {
|
||||
PlayerClockOverlay(
|
||||
currentPosition = uiState.currentPosition,
|
||||
duration = uiState.duration
|
||||
duration = uiState.duration,
|
||||
playbackSpeed = uiState.playbackSpeed
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1797,7 +1798,8 @@ private fun SeekOverlay(uiState: PlayerUiState) {
|
|||
@Composable
|
||||
private fun PlayerClockOverlay(
|
||||
currentPosition: Long,
|
||||
duration: Long
|
||||
duration: Long,
|
||||
playbackSpeed: Float
|
||||
) {
|
||||
var nowMs by remember { mutableStateOf(System.currentTimeMillis()) }
|
||||
val context = LocalContext.current
|
||||
|
|
@ -1812,7 +1814,9 @@ private fun PlayerClockOverlay(
|
|||
}
|
||||
}
|
||||
|
||||
val remainingMs = (duration - currentPosition).coerceAtLeast(0L)
|
||||
val effectiveSpeed = playbackSpeed.takeIf { it > 0f } ?: 1f
|
||||
val remainingMediaMs = (duration - currentPosition).coerceAtLeast(0L)
|
||||
val remainingMs = kotlin.math.ceil(remainingMediaMs.toDouble() / effectiveSpeed.toDouble()).toLong()
|
||||
val endTimeText = if (duration > 0L) {
|
||||
timeFormatter.format(Date(nowMs + remainingMs))
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue