✨(frontend) add localStorage persistence for audio output device
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.
This commit is contained in:
committed by
aleb_the_flash
parent
890e043d29
commit
355db6ef9a
@@ -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
|
||||
},
|
||||
|
||||
@@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user