我正在尝试在Chrome上为用户查看“相机”,但是最近几个月它已停止工作。它曾经在几个月前可以工作,但现在不起作用。
// Get access to the camera!
if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
// Not adding `{ audio: true }` since we only want video now
navigator.mediaDevices.getUserMedia({ video: true }).then(function(stream) {
//video.src = window.URL.createObjectURL(stream); Firefox gives error on this line now but didn't used to it
video.srcObject = stream;
video.play();
});
}
如何使用html5使相机在Chrome上正常工作?