📜  Html 请求相机访问 - Html 代码示例

📅  最后修改于: 2022-03-11 14:53:16.182000             🧑  作者: Mango

代码示例6
if (navigator.mediaDevices.getUserMedia) {
  navigator.mediaDevices.getUserMedia({ video: true })
    .then(function (stream) {
      video.srcObject = stream;
    })
    .catch(function (err0r) {
      console.log("Something went wrong!");
    });
}