From 5c3edc2539ac4d92c4cc2d37079549995203238a Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 9 May 2026 01:17:33 +0900 Subject: [PATCH] refac --- src/lib/components/chat/MessageInput/CallOverlay.svelte | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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(); }}