
        video.play();
      };
      
      // 使用canvas进行拍照
      var canvas = document.getElementById('canvas')
      $('button').on('click', function () {
        canvas.getContext('2d').drawImage(video, 0, 0, 200, 250);
        $('img').css('src', canvas.toDataURL("image/png"))
      })
      
    }).catch(function(err) {
      console.log(err.name + ": " + err.message);
    });
    
  </script>
</body>
</html>

