>
    <button class='shot'>拍照</button>
    <canvas id='canvas'></canvas>
    <img src=''>
  </div>
  
  <script type="text/javascript">
    // 视频大小
    var constraints = {audio: true, video: {width: 200,height: 250}};
    // 开启视频
    navigator.mediaDevices.getUserMedia(constraints).then(function(mediaStream) {
      console.log('getUserMedia:', mediaStream)
      var video = document.querySelector('video');
      video.srcObject = mediaStream;
      video.onloadedmetadata = function(e) {