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