Skip to main content
useDevices(): Object For more information about the different error states, see the camera-error event.

Return value

Returns an object with the following properties:
Object | null
Stores the most recent error object that was emitted through the camera-error event.
Object[]
An array of device objects that contains information about each camera.
string
‘idle’ | ‘pending’ | ‘not-supported’ | ‘granted’ | ‘blocked’ | ‘in-use’ | ‘not-found’ | ‘constraints-invalid’ | ‘constraints-none-specified’ | ‘undefined-mediadevices’ | ‘unknown’, indicates the general state of camera access.
Object | undefined
References the selected device in the cameras array.
Object | undefined
References the selected device in the microphones array.
Object | undefined
References the selected device in the speakers array.
boolean
true in case camState is one of ‘blocked’ | ‘in-use’ | ‘not-found’ | ‘constraints-invalid’ | ‘constraints-none-specified’ | ‘undefined-mediadevices’ | ‘unknown’.
boolean
true in case micState is one of ‘blocked’ | ‘in-use’ | ‘not-found’ | ‘constraints-invalid’ | ‘constraints-none-specified’ | ‘undefined-mediadevices’ | ‘unknown’.
Object[]
An array of device objects that contains information about each microphone.
string
‘idle’ | ‘pending’ | ‘not-supported’ | ‘granted’ | ‘blocked’ | ‘in-use’ | ‘not-found’ | ‘constraints-invalid’ | ‘constraints-none-specified’ | ‘undefined-mediadevices’ | ‘unknown’, indicates the general state of microphone access.
Function
Refreshes the list of devices using enumerateDevices().
Function
Switches to the camera with the specified deviceId. Calls setInputDevicesAsync().
Function
Switches to the mic with the specified deviceId. Calls setInputDevicesAsync().
Function
Switches to the speaker with the specified deviceId. Calls setOutputDeviceAsync().
Object[]
An array of device objects that contains information about each speaker.

About camState and micState

With 0.7.0 camState and micState have a new default value of "idle" (in previous versions of Daily React, this value was "pending"). Both states remain "idle" as long as no device access has been requested, which is the case for rooms configured with start_audio_off: true and start_video_off: true. Once device access is requested, camState and micState switch to "pending", as long as device access is pending. Once the user grants device access they will switch to "granted". In case the user blocked device access they switch to "blocked" accordingly. In case of an error the most representative error state will be applied.

Device object properties

Object

Example

See also