<button id="hideposition">不显示</button>
<br/>
<button id="mouse">张嘴验证</button>
<button id="head">摇头验证</button>
<button id="eye">眨眼验证</button>
<div id="tip">
</div>
<div id="result">
</div>
<div id="msg">
</div>
<div id="positions">
</div>
<script>
var showpos=false;
// Put event listeners into place
//window.addEventListener("DOMContentLoaded", function() {
// Grab elements, create settings, etc.
var canvas = document.getElementById("canvas"),
context = canvas.getContext("2d"),
video = document.getElementById("video"),
videoObj = { "video": true },
errBack = function(error) {
if (error.PERMISSION_DENIED) {
jAlert(‘用户拒绝了浏览器请求媒体的权限’, ‘提示’);
} else if (error.NOT_SUPPORTED_ERROR) {
jAlert(‘对不起,您的浏览器不支持拍照功能,请使用其他浏览器’, ‘提示’);
} else if (error.MANDATORY_UNSATISFIED_ERROR) {
jAlert(‘指定的媒体类型未接收到媒体流’, ‘提示’);
} else {
jAlert(‘系统未能获取到摄像头,请确保摄像头已正确安装。或尝试刷新页面,重试’, ‘提示’);
}
};
// Put video listeners into place
if(navigator.getUserMedia) { // Standard
navigator.getUserMedia(videoObj, function(stream) {
video.src = stream;
video.play();
}, errBack);
} else if(navigator.webkitGetUserMedia) { // WebKit-prefixed
try{
navigator.webkitGetUserMedia(videoObj, function(stream){









