✨(frontend) add persistence for subscribed video resolution preferences
Implement user choice persistence for video resolution settings of subscribed tracks from other participants. Maintains user preferences for received video quality across sessions, allowing consistent bandwidth optimization and viewing experience without reconfiguring subscription settings each visit.
This commit is contained in:
committed by
aleb_the_flash
parent
803c94a80c
commit
9728603f72
@@ -2,6 +2,7 @@ import { useSnapshot } from 'valtio'
|
||||
import { userChoicesStore } from '@/stores/userChoices'
|
||||
import type { VideoResolution } from '@/stores/userChoices'
|
||||
import { ProcessorSerialized } from '@/features/rooms/livekit/components/blur'
|
||||
import type { VideoQuality } from 'livekit-client'
|
||||
|
||||
export function usePersistentUserChoices() {
|
||||
const userChoicesSnap = useSnapshot(userChoicesStore)
|
||||
@@ -26,6 +27,9 @@ export function usePersistentUserChoices() {
|
||||
saveVideoPublishResolution: (resolution: VideoResolution) => {
|
||||
userChoicesStore.videoPublishResolution = resolution
|
||||
},
|
||||
saveVideoSubscribeQuality: (quality: VideoQuality) => {
|
||||
userChoicesStore.videoSubscribeQuality = quality
|
||||
},
|
||||
saveUsername: (username: string) => {
|
||||
userChoicesStore.username = username
|
||||
},
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
saveUserChoices,
|
||||
LocalUserChoices as LocalUserChoicesLK,
|
||||
} from '@livekit/components-core'
|
||||
import { VideoQuality } from 'livekit-client'
|
||||
|
||||
export type VideoResolution = 'h720' | 'h360' | 'h180'
|
||||
|
||||
@@ -13,6 +14,7 @@ export type LocalUserChoices = LocalUserChoicesLK & {
|
||||
noiseReductionEnabled?: boolean
|
||||
audioOutputDeviceId?: string
|
||||
videoPublishResolution?: VideoResolution
|
||||
videoSubscribeQuality?: VideoQuality
|
||||
}
|
||||
|
||||
function getUserChoicesState(): LocalUserChoices {
|
||||
@@ -20,6 +22,7 @@ function getUserChoicesState(): LocalUserChoices {
|
||||
noiseReductionEnabled: false,
|
||||
audioOutputDeviceId: 'default', // Use 'default' to match LiveKit's standard device selection behavior
|
||||
videoPublishResolution: 'h720',
|
||||
videoSubscribeQuality: VideoQuality.HIGH,
|
||||
...loadUserChoices(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user