From 2e41edbc9992d4d20f9dc820538b1729c999cffe Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Mon, 27 Apr 2026 20:17:12 +0200 Subject: [PATCH] feat(camera): use cameraDeviceId from voiceStore on camera enable --- packages/web/src/utils/voiceActions.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/web/src/utils/voiceActions.ts b/packages/web/src/utils/voiceActions.ts index cf2eece7..1f6074da 100644 --- a/packages/web/src/utils/voiceActions.ts +++ b/packages/web/src/utils/voiceActions.ts @@ -1,3 +1,4 @@ +import type { VideoCaptureOptions } from 'livekit-client'; import { useVoiceStore } from '../stores/voiceStore'; import { useUIStore } from '../stores/uiStore'; import { getActiveRoom } from '../hooks/useLiveKit'; @@ -60,9 +61,15 @@ export async function handleCameraAction(): Promise { try { const willEnable = !isCameraOn; if (willEnable) { + const cameraDeviceId = useVoiceStore.getState().cameraDeviceId; + const captureOpts: VideoCaptureOptions = { + resolution: CAMERA_PRESET.resolution, + frameRate: CAMERA_PRESET.encoding.maxFramerate, + }; + if (cameraDeviceId) captureOpts.deviceId = cameraDeviceId; await room.localParticipant.setCameraEnabled( true, - { resolution: CAMERA_PRESET.resolution, frameRate: CAMERA_PRESET.encoding.maxFramerate }, + captureOpts, { videoCodec: CAMERA_PRESET.codec, videoEncoding: CAMERA_PRESET.encoding,