我是程序编码的开始。只是尝试查看用户是否有可用的网络摄像头并以 html 格式打印。到目前为止,我设法在下面编写了这段代码:
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="jquery.webcam.js"></script>
</head>
<body>
<h2>Camera and Audio Status</h2>
<div id="StatusList">
</div>
<script type="text/javascript">
$("#camera").webcam(
{
width: 320,
height: 240,
mode: "callback",
swffile: "/lorran/jscam_canvas_only.swf",
onTick: function() {},
onSave: function() {},
onCapture: function() {},
debug: function() {},
onLoad: function() {} }
);
var statusHTML='<ul class="bulleted">';
var test;
test = function()
{
var tester = false;
try
{
if(webcam.getCameraList().length == 0)
{
/*alert('You dont have a camera');*/
statusHTML +='<p>camera is not avaible</p>';
return;
}
else
{
/*alert("cam");*/
statusHTML +='<p>camera avaible</p>';
return;
}
tester = true;
}
catch(e)
{
tester = false;
setTimeout(test,1000);
}
}
setTimeout(test,1000);
statusHTML +='</ul>';
$('#StatusList').html(statusHTML);
</script>
</body>
我在页面或控制台中看不到任何内容:(我已经下载并添加了jquery.webcam.js
。我完全错误的方向吗?
http://lyncchecker.ucb.com/我试图让一些东西看起来像这样。