enumerateDevices (formally navigator.mediaDevices.enumerateDevices) is the WebRTC API for listing all available media input and output devices – cameras, microphones, and speakers.
It is used with WebRTC applications to figure out which devices are available for use, letting the user pick and choose the one most suitable for his needs.
To maintain the user’s privacy, calling enumerateDevices() prior to receiving the user’s permission via getUserMedia will return identifiers only, skipping the details around their kind and label.
How enumerateDevices works
const devices = await navigator.mediaDevices.enumerateDevices();
// Returns array of MediaDeviceInfo objects:
// { deviceId, kind, label, groupId }
Each device has a kind property: audioinput, audiooutput, or videoinput. Device labels are only available after the user has granted permission via getUserMedia – before that, labels are empty strings for privacy reasons.
Common use cases
- Device selection UI – letting users pick which camera, microphone, or speaker to use in a video call
- Device change detection – listening for the
devicechangeevent to handle USB headsets being plugged in or unplugged mid-call - Diagnostics – checking what devices are available before joining a call, commonly used in pre-call test pages
- Fingerprinting – sometimes, the information returned is used in browser fingerprinting
Practical considerations
- HTTPS required – like getUserMedia, enumerateDevices works only on secure origins
- Permission gating – device labels are hidden until media permission is granted, which means a device picker UI typically needs a getUserMedia call first
- Default device – the first device in the list for each kind is typically the system default
enumerateDevices is one of the three methods on navigator.mediaDevices, alongside getUserMedia and getDisplayMedia.


