Chrome finally implemented the new navigator.mediaDevices.getUserMedia() method, but they added security that would prevent calls from an insecure address (not https or non local servers)
You will name it as follows:
var video = document.querySelector('video'); navigator.mediaDevices.getUserMedia({video:true}).then(function(mediaStream){ window.stream = mediaStream; video.src = URL.createObjectURL(mediaStream); video.play(); });
Or you can use the official webRTC polyfill library adpater.js .
var constraints = { video: true, audio: true }; navigator.mediaDevices.getUserMedia(constraints) .then(stream => video.srcObject = stream) .catch(e => console.error(e));
Kaiido
source share