From 7e0931c299774b4fdb668bc17c3fcb3c5f1ac215 Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Wed, 10 Sep 2025 12:47:12 +0200 Subject: [PATCH] Increase Element Call audio init delay (#5315) This fixed the wrong audio stream being used when starting a call locally. --- .../android/features/call/impl/utils/WebViewAudioManager.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/WebViewAudioManager.kt b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/WebViewAudioManager.kt index 51f758a3bb..7745cda13b 100644 --- a/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/WebViewAudioManager.kt +++ b/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/WebViewAudioManager.kt @@ -29,7 +29,7 @@ import kotlinx.serialization.json.Json import timber.log.Timber import java.util.concurrent.Executors import java.util.concurrent.atomic.AtomicBoolean -import kotlin.time.Duration.Companion.milliseconds +import kotlin.time.Duration.Companion.seconds /** * This class manages the audio devices for a WebView. @@ -246,7 +246,6 @@ class WebViewAudioManager( private fun registerWebViewDeviceSelectedCallback() { val webViewAudioDeviceSelectedCallback = AndroidWebViewAudioBridge( onAudioDeviceSelected = { selectedDeviceId -> - Timber.d("Audio device selected in webview, id: $selectedDeviceId") previousSelectedDevice = listAudioDevices().find { it.id.toString() == selectedDeviceId } audioManager.selectAudioDevice(selectedDeviceId) }, @@ -254,7 +253,7 @@ class WebViewAudioManager( coroutineScope.launch(Dispatchers.Main) { // Even with the callback, it seems like starting the audio takes a bit on the webview side, // so we add an extra delay here to make sure it's ready - delay(500.milliseconds) + delay(2.seconds) // Calling this ahead of time makes the default audio device to not use the right audio stream setAvailableAudioDevices()