Waits for the player to load and sets the current position of the audio

This commit is contained in:
Vitor Pamplona
2025-08-20 21:26:59 -04:00
parent a27acd9dc6
commit e1a5b9c079

View File

@@ -82,6 +82,12 @@ fun Waveform(
pollCurrentDuration(it).collect { value -> waveformProgress.floatValue = value }
}
}
LaunchedEffect(Unit) {
delay(500)
val position = mediaControllerState.controller?.let { it.currentPosition / it.duration.toFloat() } ?: 0f
waveformProgress.floatValue = position
}
}
private fun pollCurrentDuration(controller: MediaController) =