其他分享
首页 > 其他分享> > js调用pc摄像头并截图

js调用pc摄像头并截图

作者:互联网

<!DOCTYPE html>
<html>
<head>
  <title>js调用摄像头</title>
  <meta charset="utf-8"/>
</head>
<body>
<video id="video" width="600" height="600"></video>
<script>
  let video = document.getElementById("video");
  let promise = navigator.mediaDevices.getUserMedia({
    video: true,
    audio: false
  });
  promise.then(function (MediaStream) {
    video.srcObject = MediaStream;
    video.play();
  });
</script>
</body>
</html>

 

标签:截图,js,pc,video,promise,let,摄像头,MediaStream
来源: https://www.cnblogs.com/linding/p/14634961.html