From ec8a632f6a8da963af159cea22c11465bf230394 Mon Sep 17 00:00:00 2001 From: mplorentz Date: Fri, 3 Apr 2026 09:23:53 -0400 Subject: [PATCH] Add video settings to VoiceCallAudioSettingsDialog --- .../VoiceCallAudioSettingsDialog.svelte | 45 ++++++++++++++++--- src/app/components/VoiceWidget.svelte | 6 +-- src/app/voice.ts | 4 ++ 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/src/app/components/VoiceCallAudioSettingsDialog.svelte b/src/app/components/VoiceCallAudioSettingsDialog.svelte index c8afccc0..5f86ec26 100644 --- a/src/app/components/VoiceCallAudioSettingsDialog.svelte +++ b/src/app/components/VoiceCallAudioSettingsDialog.svelte @@ -26,8 +26,10 @@ let audioInputs = $state([]) let audioOutputs = $state([]) + let videoInputs = $state([]) let selectedInput = $state("") let selectedOutput = $state("") + let selectedVideo = $state("") const loadDevices = async () => { if (!navigator.mediaDevices?.enumerateDevices) return @@ -35,16 +37,25 @@ const devices = await navigator.mediaDevices.enumerateDevices() audioInputs = devices.filter(d => d.kind === "audioinput") audioOutputs = devices.filter(d => d.kind === "audiooutput") + videoInputs = devices.filter(d => d.kind === "videoinput") } catch { audioInputs = [] audioOutputs = [] + videoInputs = [] } } $effect(() => { - loadDevices() - navigator.mediaDevices?.addEventListener?.("devicechange", loadDevices) - return () => navigator.mediaDevices?.removeEventListener?.("devicechange", loadDevices) + void loadDevices() + const md = navigator.mediaDevices + if (!md?.addEventListener) return + const onDeviceChange = () => { + void loadDevices() + } + md.addEventListener("devicechange", onDeviceChange) + return () => { + md.removeEventListener("devicechange", onDeviceChange) + } }) $effect(() => { @@ -55,6 +66,7 @@ } selectedInput = selectValueForActiveDevice(session, DeviceKind.AudioInput) selectedOutput = selectValueForActiveDevice(session, DeviceKind.AudioOutput) + selectedVideo = selectValueForActiveDevice(session, DeviceKind.VideoInput) }) const onInputChange = () => { @@ -65,6 +77,10 @@ void switchVoiceActiveDevice(DeviceKind.AudioOutput, selectedOutput) } + const onVideoChange = () => { + void switchVoiceActiveDevice(DeviceKind.VideoInput, selectedVideo) + } + const onDone = () => { popModal() } @@ -76,8 +92,8 @@ - Audio settings - Choose microphone and speaker for this call. + Call settings + Microphone, speaker, and camera for this call.
@@ -120,6 +136,25 @@ {/snippet} {/if} + + {#snippet label()} +

Camera

+ {/snippet} + {#snippet input()} + + {/snippet} +
diff --git a/src/app/components/VoiceWidget.svelte b/src/app/components/VoiceWidget.svelte index 89d2c0b5..aa2b995c 100644 --- a/src/app/components/VoiceWidget.svelte +++ b/src/app/components/VoiceWidget.svelte @@ -71,7 +71,7 @@ pushModal(VoiceRoomJoinDialog, {url: targetRoom.url, h: targetRoom.h}) } - const openAudioSettings = () => { + const openCallSettings = () => { pushModal(VoiceCallAudioSettingsDialog) } @@ -128,9 +128,9 @@