Note: Counts cameras, microphones, and speakers without accessing them. No permission required for device count.
The enumerateDevices() method returns a count and list of available media input/output devices (cameras, microphones, speakers) without requiring user permission. Only device labels require permission.
The MediaDevices API was created to give web applications access to cameras and microphones for video conferencing, photo capture, and audio recording. The enumerateDevices() method helps apps present device selection menus.
3-5 devices: Built-in webcam, mic, speakers
0-2 devices: External webcam/mic (if connected)
4-6 devices: Front/rear cameras, mic, earpiece, speaker
10+ devices: Multiple cameras, studio mics, audio interfaces
navigator.mediaDevices.enumerateDevices()
.then(devices => {
console.log('Total devices:', devices.length);
console.log('Videoinput:', devices.filter(d => d.kind === 'videoinput').length);
console.log('Audioinput:', devices.filter(d => d.kind === 'audioinput').length);
console.log('Audiooutput:', devices.filter(d => d.kind === 'audiooutput').length);
});| Device Type | Typical Count | Notes |
|---|---|---|
| MacBook | 3-4 | FaceTime camera, mic, speakers |
| Windows Laptop | 3-5 | Webcam, mic, speakers (varies by model) |
| iPhone | 5-6 | Front/back cameras, mics, speakers |
| Android Phone | 4-7 | Varies greatly by model |
| Desktop PC (no peripherals) | 0-1 | Only speakers (if integrated audio) |
| Desktop PC (full setup) | 5+ | External webcam, mic, headset, speakers |
Media device enumeration is one of the strongest device fingerprinting techniques. The number and type of devices is highly distinctive and persistent across sessions.
Most users have a specific combination of cameras, microphones, and speakers that's unique. For example, a laptop with built-in camera + USB mic + Bluetooth headphones creates a distinctive signature.
Each device has a unique ID that doesn't change. Even without device labels, the ID itself is fingerprintable and persists across browser sessions and even reinstalls.
Unlike accessing camera/microphone streams, simply counting and listing devices requires no user permission, making it a silent fingerprinting vector.
Most browsers don't offer settings to block device enumeration because it would break legitimate websites. Some options:
Blocking device enumeration will break video calling and many web apps that legitimately need to detect cameras and microphones.