jQuery webcam plugin调用webcam.capture()方法提示不存在

Alex_yyyy 2017-06-23 03:31:15
jQuery webcam plugin调用webcam.capture()方法提示不存在
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
<script src="jquery.webcam.js"></script>
</head>
<body>
<div id="webcam"></div>
<div id="avatar_priview" style="width: 320px"></div>
<input type="button" onclick=" webcam.capture();" value="拍照"/>
<script>
jQuery("#webcam").webcam({

width: 320,
height: 240,
mode: "save",
swffile: "jscam_canvas_only.swf", // canvas only doesn't implement a jpeg encoder, so the file is much smaller

onTick: function(remain) {

if (0 == remain) {
jQuery("#status").text("Cheese!");
} else {
jQuery("#status").text(remain + " seconds remaining...");
}
},

onSave: function(data) {

var col = data.split(";");
alert(data);
console.info(data);
// Work with the picture. Picture-data is encoded as an array of arrays... Not really nice, though =/
},

onCapture: function () {
webcam.save();

// Show a flash for example
},

debug: function (type, string) {
// Write debug information to console.log() or a div, ...
console.log(type+":"+string);
},

onLoad: function () {
// Page load
var cams = webcam.getCameraList();
for(var i in cams) {
jQuery("#cams").append("<li>" + cams[i] + "</li>");
}
}
});
</script>
</body>
</html>
...全文
578 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
XIAOZUO1 2017-06-27
  • 打赏
  • 举报
回复
试试在IIS部署后调用.

87,990

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧