I create asp.net web application and copy code from https://webrtc.github.io/samples/src/content/getusermedia/canvas/ and public project to iis link http://123.111.1.222/test/camera.aspx not working is error
This is the error message
Uncaught TypeError: Cannot read properties of undefined (reading 'enumerateDevices'
code here
navigator.mediaDevices.enumerateDevices().then(gotDevices).catch(handleError);
You need to be on
https://
orlocalhost
fornavigator.mediaDevices
to be available.For security purposes, accessing
mediaDevices
onhttp://
is not allowed. Therefore, you receive an error that it cannot find the fuctionenumerateDevices
, because indeed,mediaDevices
is undefined.Solutions, from easy to hard:
localhost
as your development server.https
.https://
.