Skip to main content
GitHub

Source

usePersistentUserChoices

Note

This feature is experimental and may change or be removed based on developer feedback and real-world usage.

A hook that provides access to user choices stored in local storage, such as selected media devices and their current state (on or off), as well as the user name.

Import

import { usePersistentUserChoices } from "@livekit/components-react";

Properties

options.defaultsPartial<LocalUserChoices>

The default value to use if reading from local storage returns no results or fails.

options.preventLoadboolean

Whether to prevent loading user choices from persistent storage and use defaults instead.

options.preventSaveboolean

Whether to prevent saving to persistent storage.

Returns

{
userChoices: LocalUserChoices;
saveAudioInputEnabled: (isEnabled: boolean) => void;
saveVideoInputEnabled: (isEnabled: boolean) => void;
saveAudioInputDeviceId: (deviceId: string) => void;
saveVideoInputDeviceId: (deviceId: string) => void;
saveUsername: (username: string) => void;
}