From 24efe741623b3d07967467593156fb59accf5de5 Mon Sep 17 00:00:00 2001 From: Flemmli97 <34157027+Flemmli97@users.noreply.github.com> Date: Thu, 2 Jan 2025 15:00:37 +0100 Subject: [PATCH 1/2] fix(settings): fix video test and constraint (#971) --- src/lib/components/settings/VideoTest.svelte | 19 ++++--------------- src/routes/settings/audio_video/+page.svelte | 2 +- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/lib/components/settings/VideoTest.svelte b/src/lib/components/settings/VideoTest.svelte index b8aadcf13..82ead20aa 100644 --- a/src/lib/components/settings/VideoTest.svelte +++ b/src/lib/components/settings/VideoTest.svelte @@ -6,17 +6,9 @@ import { _ } from "svelte-i18n" import { get } from "svelte/store" - export let audioInput: string | undefined - export let videoInput: string | undefined - let video: HTMLVideoElement let stream: MediaStream - Store.state.devices.video.subscribe(d => { - videoInput = d - switchCamera(videoInput) - }) - async function switchCamera(selectedVideoDeviceId: string) { try { if (stream) { @@ -35,13 +27,10 @@ } async function startVideoTest() { - videoInput = get(Store.state.devices.video) - const constraints = { - audio: { - deviceId: audioInput ? { exact: audioInput } : undefined, - }, + let videoInput = get(Store.state.devices.video) + const constraints: MediaStreamConstraints = { video: { - deviceId: videoInput ? { exact: videoInput } : undefined, + deviceId: videoInput && videoInput !== "default" ? { exact: videoInput } : undefined, }, } @@ -60,7 +49,7 @@ video.srcObject = stream video.play() } catch (err) { - console.error("Accessing the microphone failed:", err) + console.error("Accessing the camera failed:", err) } } diff --git a/src/routes/settings/audio_video/+page.svelte b/src/routes/settings/audio_video/+page.svelte index 6919d3a55..6d5b90be6 100644 --- a/src/routes/settings/audio_video/+page.svelte +++ b/src/routes/settings/audio_video/+page.svelte @@ -185,7 +185,7 @@ }} />