Increase Element Call audio init delay (#5315)
This fixed the wrong audio stream being used when starting a call locally.
This commit is contained in:
parent
577a121bb2
commit
47ca80a939
1 changed files with 2 additions and 3 deletions
|
|
@ -29,7 +29,7 @@ import kotlinx.serialization.json.Json
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
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.
|
* This class manages the audio devices for a WebView.
|
||||||
|
|
@ -246,7 +246,6 @@ class WebViewAudioManager(
|
||||||
private fun registerWebViewDeviceSelectedCallback() {
|
private fun registerWebViewDeviceSelectedCallback() {
|
||||||
val webViewAudioDeviceSelectedCallback = AndroidWebViewAudioBridge(
|
val webViewAudioDeviceSelectedCallback = AndroidWebViewAudioBridge(
|
||||||
onAudioDeviceSelected = { selectedDeviceId ->
|
onAudioDeviceSelected = { selectedDeviceId ->
|
||||||
Timber.d("Audio device selected in webview, id: $selectedDeviceId")
|
|
||||||
previousSelectedDevice = listAudioDevices().find { it.id.toString() == selectedDeviceId }
|
previousSelectedDevice = listAudioDevices().find { it.id.toString() == selectedDeviceId }
|
||||||
audioManager.selectAudioDevice(selectedDeviceId)
|
audioManager.selectAudioDevice(selectedDeviceId)
|
||||||
},
|
},
|
||||||
|
|
@ -254,7 +253,7 @@ class WebViewAudioManager(
|
||||||
coroutineScope.launch(Dispatchers.Main) {
|
coroutineScope.launch(Dispatchers.Main) {
|
||||||
// Even with the callback, it seems like starting the audio takes a bit on the webview side,
|
// 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
|
// 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
|
// Calling this ahead of time makes the default audio device to not use the right audio stream
|
||||||
setAvailableAudioDevices()
|
setAvailableAudioDevices()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue