# 31401: UserMedia Permission Denied

Log Type: APPLICATION

Log Level: ERROR

## Description

This error occurs when the Voice JavaScript SDK cannot access the microphone because the browser or end user denied the `getUserMedia()` request. Twilio uses microphone input for browser-based Voice SDK calls, so the SDK cannot acquire input audio when access is blocked.

### Possible causes

* The end user denied the browser prompt for microphone access.
* The browser has a saved deny setting or site-level permission that blocks microphone access for the current address.
* Your application requests microphone access only when `device.connect()` or `call.accept()` runs, so the permission failure appears at call time instead of earlier in the flow.
* The mobile device operating system or browser has not granted microphone access.

### Possible solutions

* Request microphone access before creating `Device` by calling `navigator.mediaDevices.getUserMedia({ audio: true })`. This lets you capture permission errors earlier and improve the calling experience.
* If you call `getUserMedia()` before a call starts, stop the returned media tracks until you are ready to use the microphone so the user does not think the mic is active.
* Review microphone permissions for the current site in the browser and remove any saved deny setting, then allow microphone access the next time the browser prompts for it.
* Confirm that microphone access is enabled for the browser or app at the operating system level, especially on mobile devices.
* After permission is granted, verify that an input device is available. Browsers can return incomplete or unlabeled device information until `getUserMedia()` access is approved.

#### Additional resources

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