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,