diff --git a/src/frontend/src/features/rooms/components/Conference.tsx b/src/frontend/src/features/rooms/components/Conference.tsx index e5cf0684..1adc8f46 100644 --- a/src/frontend/src/features/rooms/components/Conference.tsx +++ b/src/frontend/src/features/rooms/components/Conference.tsx @@ -12,6 +12,7 @@ import { RoomOptions, supportsAdaptiveStream, supportsDynacast, + VideoPresets, } from 'livekit-client' import { keys } from '@/api/queryKeys' import { queryClient } from '@/api/queryClient' @@ -98,6 +99,9 @@ export const Conference = ({ }, videoCaptureDefaults: { deviceId: userConfig.videoDeviceId ?? undefined, + resolution: userConfig.videoPublishResolution + ? VideoPresets[userConfig.videoPublishResolution].resolution + : undefined, }, audioCaptureDefaults: { deviceId: userConfig.audioDeviceId ?? undefined, @@ -109,6 +113,7 @@ export const Conference = ({ // do not rely on the userConfig object directly as its reference may change on every render }, [ userConfig.videoDeviceId, + userConfig.videoPublishResolution, userConfig.audioDeviceId, userConfig.audioOutputDeviceId, isAdaptiveStreamSupported, diff --git a/src/frontend/src/features/rooms/livekit/hooks/usePersistentUserChoices.ts b/src/frontend/src/features/rooms/livekit/hooks/usePersistentUserChoices.ts index b62d4907..b9a90153 100644 --- a/src/frontend/src/features/rooms/livekit/hooks/usePersistentUserChoices.ts +++ b/src/frontend/src/features/rooms/livekit/hooks/usePersistentUserChoices.ts @@ -1,5 +1,6 @@ import { useSnapshot } from 'valtio' import { userChoicesStore } from '@/stores/userChoices' +import type { VideoResolution } from '@/stores/userChoices' import { ProcessorSerialized } from '@/features/rooms/livekit/components/blur' export function usePersistentUserChoices() { @@ -22,6 +23,9 @@ export function usePersistentUserChoices() { saveVideoInputDeviceId: (deviceId: string) => { userChoicesStore.videoDeviceId = deviceId }, + saveVideoPublishResolution: (resolution: VideoResolution) => { + userChoicesStore.videoPublishResolution = resolution + }, saveUsername: (username: string) => { userChoicesStore.username = username }, diff --git a/src/frontend/src/stores/userChoices.ts b/src/frontend/src/stores/userChoices.ts index 8f4834dd..56105662 100644 --- a/src/frontend/src/stores/userChoices.ts +++ b/src/frontend/src/stores/userChoices.ts @@ -6,16 +6,20 @@ import { LocalUserChoices as LocalUserChoicesLK, } from '@livekit/components-core' +export type VideoResolution = 'h720' | 'h360' | 'h180' + export type LocalUserChoices = LocalUserChoicesLK & { processorSerialized?: ProcessorSerialized noiseReductionEnabled?: boolean audioOutputDeviceId?: string + videoPublishResolution?: VideoResolution } function getUserChoicesState(): LocalUserChoices { return { noiseReductionEnabled: false, audioOutputDeviceId: 'default', // Use 'default' to match LiveKit's standard device selection behavior + videoPublishResolution: 'h720', ...loadUserChoices(), } }