# 31402: UserMedia Acquisition Failed

Log Type: APPLICATION

Log Level: ERROR

## Description

This error occurs when the browser has microphone permission, but the Voice JavaScript SDK cannot acquire the input media stream for a call. This usually points to an invalid device selection, overly restrictive `getUserMedia()` constraints, or a browser, operating system, or hardware issue.

### Possible causes

* A `deviceId` passed to `device.audio.setInputDevice()` does not exist or is no longer available.
* The `rtcConstraints` passed to `device.connect()` are too restrictive, so `getUserMedia()` cannot match an available device.
* Audio constraints applied with `device.audio.setAudioConstraints()` cannot be satisfied by the selected microphone.
* The browser, operating system, or local audio hardware cannot provide the microphone stream even after permission is granted.

### Possible solutions

* Verify that the selected microphone exists in `device.audio.availableInputDevices` before you call `device.audio.setInputDevice()`.
* Remove custom `rtcConstraints` or other audio constraints and test again with a simpler input request such as `audio: true`.
* If you apply constraints with `device.audio.setAudioConstraints()`, clear them with `device.audio.unsetAudioConstraints()` and retry.
* Call `getUserMedia()` before you create the `Device` so you can detect microphone and device issues earlier and refresh the available device list before a call starts.
* Test with the default input device first, then confirm the microphone works in the browser and operating system.

#### Additional resources

* [Voice JavaScript SDK: Twilio.Device](/docs/voice/sdks/javascript/twiliodevice)
* [Twilio.Device.audio](/docs/voice/sdks/javascript/twiliodevice/device-audio)
* [Voice JavaScript SDK: Best Practices](/docs/voice/sdks/javascript/best-practices)
