Skip to content

Commit 7e0931c

Browse files
authored
Increase Element Call audio init delay (#5315)
This fixed the wrong audio stream being used when starting a call locally.
1 parent b559065 commit 7e0931c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/WebViewAudioManager.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import kotlinx.serialization.json.Json
2929
import timber.log.Timber
3030
import java.util.concurrent.Executors
3131
import java.util.concurrent.atomic.AtomicBoolean
32-
import kotlin.time.Duration.Companion.milliseconds
32+
import kotlin.time.Duration.Companion.seconds
3333

3434
/**
3535
* This class manages the audio devices for a WebView.
@@ -246,15 +246,14 @@ class WebViewAudioManager(
246246
private fun registerWebViewDeviceSelectedCallback() {
247247
val webViewAudioDeviceSelectedCallback = AndroidWebViewAudioBridge(
248248
onAudioDeviceSelected = { selectedDeviceId ->
249-
Timber.d("Audio device selected in webview, id: $selectedDeviceId")
250249
previousSelectedDevice = listAudioDevices().find { it.id.toString() == selectedDeviceId }
251250
audioManager.selectAudioDevice(selectedDeviceId)
252251
},
253252
onAudioPlaybackStarted = {
254253
coroutineScope.launch(Dispatchers.Main) {
255254
// Even with the callback, it seems like starting the audio takes a bit on the webview side,
256255
// so we add an extra delay here to make sure it's ready
257-
delay(500.milliseconds)
256+
delay(2.seconds)
258257

259258
// Calling this ahead of time makes the default audio device to not use the right audio stream
260259
setAvailableAudioDevices()

0 commit comments

Comments
 (0)