Fixes the access to playback state from the wrong thread

pull/623/head
Vitor Pamplona 2023-09-26 10:55:31 -04:00
rodzic ee466aa1e4
commit e3df94338f
1 zmienionych plików z 16 dodań i 16 usunięć

Wyświetl plik

@ -291,8 +291,8 @@ fun GetVideoController(
DisposableEffect(key1 = videoUri) {
// If it is not null, the user might have come back from a playing video, like clicking on
// the notification of the video player.
scope.launch(Dispatchers.IO) {
if (controller.value == null) {
scope.launch(Dispatchers.IO) {
PlaybackClientController.prepareController(
uid,
videoUri,
@ -338,6 +338,7 @@ fun GetVideoController(
}
}
}
}
} else {
controller.value?.let {
if (it.playbackState == Player.STATE_IDLE || it.playbackState == Player.STATE_ENDED) {
@ -355,7 +356,6 @@ fun GetVideoController(
}
}
}
}
onDispose {
if (!keepPlaying.value) {