diff --git a/packages/client/components/app/interface/settings/user/voice/VoiceInputOptions.tsx b/packages/client/components/app/interface/settings/user/voice/VoiceInputOptions.tsx index c21d2cfe9..99a328653 100644 --- a/packages/client/components/app/interface/settings/user/voice/VoiceInputOptions.tsx +++ b/packages/client/components/app/interface/settings/user/voice/VoiceInputOptions.tsx @@ -22,7 +22,7 @@ export function VoiceInputOptions() { - {/* TODO O.o */} + @@ -37,19 +37,25 @@ function SelectInput(props: { kind: MediaDeviceKind }) { const media = createMemo(() => useMediaDeviceSelect({ kind: props.kind })); const setKey = () => - props.kind === "audioinput" - ? "preferredAudioInputDevice" - : "preferredAudioOutputDevice"; + props.kind === "videoinput" + ? "preferredVideoDevice" + : props.kind === "audioinput" + ? "preferredAudioInputDevice" + : "preferredAudioOutputDevice"; const icon = () => - props.kind === "audioinput" ? ( + props.kind === "videoinput" ? ( + camera_video + ) : props.kind === "audioinput" ? ( mic ) : ( speaker ); const title = () => - props.kind === "audioinput" ? ( + props.kind === "videoinput" ? ( + Select video input + ) : props.kind === "audioinput" ? ( Select audio input ) : ( Select audio output diff --git a/packages/client/components/state/stores/Voice.ts b/packages/client/components/state/stores/Voice.ts index 6968d7451..5d37e64d9 100644 --- a/packages/client/components/state/stores/Voice.ts +++ b/packages/client/components/state/stores/Voice.ts @@ -30,6 +30,7 @@ export const ScreenShareQualityNames: ScreenShareQualityName[] = [ export interface TypeVoice { preferredAudioInputDevice?: string; preferredAudioOutputDevice?: string; + preferredVideoDevice?: string; echoCancellation: boolean; noiseSupression: NoiseSuppresionState; @@ -99,6 +100,10 @@ export class Voice extends AbstractStore<"voice", TypeVoice> { data.preferredAudioOutputDevice = input.preferredAudioOutputDevice; } + if (typeof input.preferredVideoDevice === "string") { + data.preferredVideoDevice = input.preferredVideoDevice; + } + if (typeof input.echoCancellation === "boolean") { data.echoCancellation = input.echoCancellation; } @@ -216,6 +221,13 @@ export class Voice extends AbstractStore<"voice", TypeVoice> { this.set("preferredAudioOutputDevice", value); } + /** + * Set the preferred video input device + */ + set preferredVideoDevice(value: string) { + this.set("preferredVideoDevice", value); + } + /** * Set echo cancellation */ @@ -293,6 +305,13 @@ export class Voice extends AbstractStore<"voice", TypeVoice> { return this.get().preferredAudioInputDevice; } + /** + * Get the preferred video input device + */ + get preferredVideoDevice(): string | undefined { + return this.get().preferredVideoDevice; + } + /** * Get echo cancellation */