Navigator.getUserMedia()
Can the navigator.getUserMedia function be undefined because the camera or access to the microphone is not granted access?
From the documentation:
This is a legacy method. Please use the newer navigator.mediaDevices.getUserMedia() instead.
For example:
async function getMedia(constraints) {
let stream = null;
try {
stream = await navigator.mediaDevices.getUserMedia(constraints);
console.log('1')
/* use the stream */
} catch (err) {
/* handle the error */
}
}
getMedia({audio: true, video: true})
Source: MediaDevices documentation.