From 95afbadfe6b6f11dff1e2f8216942f62400775f6 Mon Sep 17 00:00:00 2001 From: bingochaos <523834173@qq.com> Date: Tue, 15 Apr 2025 10:32:52 +0800 Subject: [PATCH] Update index.svelte --- frontend/shared/VideoChat/index.svelte | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/shared/VideoChat/index.svelte b/frontend/shared/VideoChat/index.svelte index fe5bf35..6e4823d 100644 --- a/frontend/shared/VideoChat/index.svelte +++ b/frontend/shared/VideoChat/index.svelte @@ -150,6 +150,16 @@ micMuted = false; cameraOff = false; volumeMuted = false; + await navigator.mediaDevices + .getUserMedia({ + audio: true, + }) + .catch(() => {}); + await navigator.mediaDevices + .getUserMedia({ + video: true, + }) + .catch(() => {}); const devices = await get_devices(); available_video_devices = set_available_devices(devices, "videoinput"); available_audio_devices = set_available_devices(devices, "audioinput"); @@ -157,8 +167,8 @@ console.log(available_audio_devices); await get_stream( - devices.some((device) => device.kind === "audioinput"), - devices.some((device) => device.kind === "videoinput"), + devices.some((device) => device.kind === "audioinput" && device.deviceId), + devices.some((device) => device.kind === "videoinput" && device.deviceId), node, track_constraints, )