Skip to content

Commit 2880782

Browse files
committed
First attempt at feeding the audio devices to the webview
1 parent 0f43476 commit 2880782

File tree

1 file changed

+6
-0
lines changed
  • features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui

1 file changed

+6
-0
lines changed

features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/CallScreenView.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ private fun CallWebView(
191191
update = { webView ->
192192
if (url is AsyncData.Success && webView.url != url.data) {
193193
webView.loadUrl(url.data)
194+
195+
val audioManager = webView.context.getSystemService<AudioManager>()!!
196+
val devices = audioManager.loadCommunicationAudioDevices()
197+
webView.evaluateJavascript("""
198+
controls.setOutputDevices([${devices.joinToString(",") { "{ 'id': '${it.id}', 'name': '${it.description()}' }" } }])
199+
""".trimIndent(), null)
194200
}
195201
},
196202
onRelease = { webView ->

0 commit comments

Comments
 (0)