Skip to content

Instantly share code, notes, and snippets.

@sorie
Created July 1, 2021 09:00
Show Gist options
  • Save sorie/46c437f0400d9dad8d598731e8c6ae05 to your computer and use it in GitHub Desktop.
Save sorie/46c437f0400d9dad8d598731e8c6ae05 to your computer and use it in GitHub Desktop.
navigator.mediaDevices.enumerateDevices() will return an empty label
/**
navigator.mediaDevices.enumerateDevices() will return an empty label attribute value
if the permission for accessing the mediadevice is not given.
Try using it after getUserMedia.
**/
(async () => {
await navigator.mediaDevices.getUserMedia({audio: true, video: true});
let devices = await navigator.mediaDevices.enumerateDevices();
console.log(devices);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment