mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 18:56:55 +01:00
Waits for the player to load and sets the current position of the audio
This commit is contained in:
@@ -82,6 +82,12 @@ fun Waveform(
|
|||||||
pollCurrentDuration(it).collect { value -> waveformProgress.floatValue = value }
|
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) =
|
private fun pollCurrentDuration(controller: MediaController) =
|
||||||
|
|||||||
Reference in New Issue
Block a user