Skip to contentSkip to navigationSkip to topbar
Page toolsOn this pageProducts used
Looking for more inspiration?Visit the

31401: UserMedia Permission Denied


ERROR: 31401

error-31401 page anchor
VOICE
ERROR

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

possible-causes page anchor
  • 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.
  • 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

additional-resources page anchor