empty
html5调用摄像头实现拍照
<script type="text/javascript">
var video=document.getElementById("video");
var context=canvas.getContext("2d");
var errocb=function(){
console.log("sth srong");
}
if(navigator.getUserMedia){
navigator.getUserMedia({"video":true},function(stream){
video.src=stream;
video.play();
},errocb);
}else if(navigator.webkitGetUserMedia){
navigator.webkitGetUserMedia({"video":true},function(stream){
video.src=window.webkitURL.createObjectURL(stream);
video.play();
},errocb);
}
document.getElementById("paizhao").addEventListener("click",function(){
context.drawImage(video,0,0,640,480);
});
</script>
没有摄像头,测试了的记得评论下,谢谢
不标注未测的都已经实际测试过,放心使用