<div id="viddiv" width:100%; height:100%"> <video id="livevideo" width="100%" height="100%" autoplay></video> </div> <div id="picdiv" <div id="picdivbuttons" <button <button again</button> <button <span id="resolution">WxH:</span> </div> <div id="picdivcanvas" <canvas id="takenpic"></canvas> </div> </div> [removed] var video = document.getElementById("livevideo"); var canvas = document.getElementById("takenpic"); var context = canvas.getContext("2d"); navigator.getMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia ); navigator.getMedia( {video: true}, function(stream) { video.src = window.URL.createObjectURL(stream); }, function(err) { alert("No camera access!"); } ); video.addEventListener('click', takepic, false); function takepic() { var vw = video.videoWidth; var vh = video.videoHeight; document.getElementById("resolution")[removed] = ("Width x Height: " + vw + " x " + vh); canvas.width = vw; canvas.height = vh; context.drawImage(video, 0, 0); document.getElementById("picdiv").style.display = "block"; document.getElementById("viddiv").style.display = "none"; } function upload() { var d = document.getElementById("takenpic").toDataURL("image/jpeg"); d = d.slice(d.indexOf(",") + 1); ajaxRequest(frmMain.hfrWebCamPic, "saveimg", ["img="+d]); } function tryagain() { document.getElementById("picdiv").style.display = "none"; document.getElementById("viddiv").style.display = "block"; } function closeapp() { ajaxRequest(frmMain.hfrWebCamPic, "closeapp", []); } [removed]
- 1
- 粉丝: 5
- 资源: 16
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助