From 355db6ef9aea58f23ebac438d3cda8045836cdf3 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Mon, 11 Aug 2025 19:26:00 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(frontend)=20add=20localStorage=20pers?= =?UTF-8?q?istence=20for=20audio=20output=20device?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement audio output device persistence in localStorage since LiveKit doesn't handle this by default. Ensures user's preferred audio output selection is remembered across sessions, improving user experience by maintaining device preferences without requiring re-selection on each visit. --- .../features/rooms/livekit/hooks/usePersistentUserChoices.ts | 3 +++ src/frontend/src/stores/userChoices.ts | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/frontend/src/features/rooms/livekit/hooks/usePersistentUserChoices.ts b/src/frontend/src/features/rooms/livekit/hooks/usePersistentUserChoices.ts index 5d457efb..b62d4907 100644 --- a/src/frontend/src/features/rooms/livekit/hooks/usePersistentUserChoices.ts +++ b/src/frontend/src/features/rooms/livekit/hooks/usePersistentUserChoices.ts @@ -16,6 +16,9 @@ export function usePersistentUserChoices() { saveAudioInputDeviceId: (deviceId: string) => { userChoicesStore.audioDeviceId = deviceId }, + saveAudioOutputDeviceId: (deviceId: string) => { + userChoicesStore.audioOutputDeviceId = deviceId + }, saveVideoInputDeviceId: (deviceId: string) => { userChoicesStore.videoDeviceId = deviceId }, diff --git a/src/frontend/src/stores/userChoices.ts b/src/frontend/src/stores/userChoices.ts index b0ce11f8..8f4834dd 100644 --- a/src/frontend/src/stores/userChoices.ts +++ b/src/frontend/src/stores/userChoices.ts @@ -9,11 +9,13 @@ import { export type LocalUserChoices = LocalUserChoicesLK & { processorSerialized?: ProcessorSerialized noiseReductionEnabled?: boolean + audioOutputDeviceId?: string } function getUserChoicesState(): LocalUserChoices { return { noiseReductionEnabled: false, + audioOutputDeviceId: 'default', // Use 'default' to match LiveKit's standard device selection behavior ...loadUserChoices(), } }