diff --git a/src/lib/components/chat/MessageInput/CallOverlay.svelte b/src/lib/components/chat/MessageInput/CallOverlay.svelte index d5977c0eb0..58ac2a6663 100644 --- a/src/lib/components/chat/MessageInput/CallOverlay.svelte +++ b/src/lib/components/chat/MessageInput/CallOverlay.svelte @@ -63,7 +63,12 @@ console.log(videoInputDevices); if (selectedVideoInputDeviceId === null && videoInputDevices.length > 0) { - selectedVideoInputDeviceId = videoInputDevices[0].deviceId; + const savedDeviceId = localStorage.getItem('selectedVideoInputDeviceId'); + if (savedDeviceId && videoInputDevices.some((d) => d.deviceId === savedDeviceId)) { + selectedVideoInputDeviceId = savedDeviceId; + } else { + selectedVideoInputDeviceId = videoInputDevices[0].deviceId; + } } }; @@ -890,6 +895,7 @@ on:change={async (e) => { console.log(e.detail); selectedVideoInputDeviceId = e.detail; + localStorage.setItem('selectedVideoInputDeviceId', e.detail); await stopVideoStream(); await startVideoStream(); }}