mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-13 12:17:24 +00:00
751d029ac9
Now that the exact deviceId constraint has been dropped, the browser can pick a different device than the one persisted in localStorage (for example when the persisted device is no longer available). Sync the persisted ids in localStorage with the device id that was actually selected on the started track, so the local cache stays consistent with what the app is really using.
21 lines
614 B
TypeScript
21 lines
614 B
TypeScript
import { useLocalParticipant } from '@livekit/components-react'
|
|
import type { LocalTrack } from 'livekit-client'
|
|
import { useSyncTrackDeviceId } from '../hooks/useSyncTrackDeviceId'
|
|
import {
|
|
saveAudioInputDeviceId,
|
|
saveVideoInputDeviceId,
|
|
} from '@/stores/userChoices'
|
|
|
|
export const SyncDevicePreferences = () => {
|
|
const { cameraTrack, microphoneTrack } = useLocalParticipant()
|
|
useSyncTrackDeviceId(
|
|
cameraTrack?.track as LocalTrack | undefined,
|
|
saveVideoInputDeviceId
|
|
)
|
|
useSyncTrackDeviceId(
|
|
microphoneTrack?.track as LocalTrack | undefined,
|
|
saveAudioInputDeviceId
|
|
)
|
|
return null
|
|
}
|