Skip to main content

Interface: IndexedDevices

Methods

anyAuthorizedDevice

anyAuthorizedDevice(kind?): boolean

true when there is any authorized device of the kind. When kind is not provided, it checks for any audio or video input device.

Parameters

NameType
kind?MediaDeviceKind

Returns

boolean


first

first(kind): undefined | MediaDeviceInfoLike

First device of the kind

Parameters

NameType
kindMediaDeviceKind

Returns

undefined | MediaDeviceInfoLike


get

get(device?): MediaDeviceInfoLike[]

Get devices by kind and device id or label When both deviceId and label are provided, it will use deviceId to find the device, and when it's not found, it will use label to find

When device is not provided, it returns all devices.

Parameters

NameTypeDescription
device?Pick<Partial<MediaDeviceInfoLike>, "deviceId" | "groupId" | "kind" | "label">the device to find

Returns

MediaDeviceInfoLike[]

found devices otherwise empty array


size

size(kind?): number

Size of particular kind of devices. When kind is not specified, it returns the total size.

Parameters

NameType
kind?MediaDeviceKind

Returns

number


toJSON

toJSON(): Record<MediaDeviceKind, MediaDeviceInfoLike[]>

Returns

Record<MediaDeviceKind, MediaDeviceInfoLike[]>