useDevices
useDevices(): Object
Returns information about a participant's media devices and their states, along with helper functions that wrap daily-js
device-related methods.
Return type
Returns an object with the following properties:
Name | Type | Description |
---|---|---|
cameras | Object[] | An array of device objects that detail information about each camera |
camState | string | 'pending' | 'not-supported' | 'granted' | 'blocked' | 'in-use' | 'not-found' , indicates the general state of camera access |
hasCamError | boolean | true in case camState is one of 'blocked' | 'in-use' | 'not-found' |
hasMicError | boolean | true in case micState is one of 'blocked' | 'in-use' | 'not-found' |
microphones | Object[] | An array of device objects that detail information about each microphone |
micState | string | 'pending' | 'not-supported' | 'granted' | 'blocked' | 'in-use' | 'not-found' , indicates the general state of microphone access |
refreshDevices | Function | Refreshes the list of devices using enumerateDevices() |
setCamera | Function | Switches to the camera with the specified deviceId . Calls setInputDevicesAsync() |
setMicrophone | Function | Switches to the mic with the specified deviceId . Calls setInputDevicesAsync() |
setSpeaker | Function | Switches to the speaker with the specified deviceId . Calls setInputDevicesAsync() |
speakers | Object[] | An array of device objects that detail information about each speaker |
Device object properties
Name | Type | Description |
---|---|---|
device | Object | The same device information returned from enumerateDevices() |
selected | boolean | true when this specific device is currently being used by getUserMedia() |
state | string | 'granted' | 'in-use' , 'granted' means the device is available, 'in-use' means the device is used by another app |