From 1387a0f62b04d133091f7a0d56264d5f5104624b Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Tue, 26 Sep 2023 10:56:28 -0400 Subject: [PATCH] Adds note to make sure we know the callback of a prepare video runs in the main thread. --- .../com/vitorpamplona/amethyst/ui/components/VideoView.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt index 3e3f7d44b..d46790ddb 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt @@ -299,6 +299,8 @@ fun GetVideoController( nostrUriCallback, context ) { + // REQUIRED TO BE RUN IN THE MAIN THREAD + // checks again because of race conditions. if (controller.value == null) { // still prone to race conditions. controller.value = it @@ -382,6 +384,8 @@ fun GetVideoController( nostrUriCallback, context ) { + // REQUIRED TO BE RUN IN THE MAIN THREAD + // checks again to make sure no other thread has created a controller. if (controller.value == null) { controller.value = it