我有2个网络摄像头连接到我的电脑。我正在使用这个库https://github.com/infusion/jQuery-webcam。
我可以查看网络摄像头没问题,我也可以通过右键单击更改为其他摄像头,然后弹出Adobe Flash Player,我可以选择其他摄像头。
关注此网站: http://sshilko.com/examples/jQuery-AS3-Webcam/example.html
该网站显示的示例,它可以通过从下拉列表中选择来更改相机。
但是我的代码卡在了
debug: function (type, string) {
if (type == 'error') {
$("#lblCameraList").html(string);
} else {
$("#lblCameraList").html('');
}
},
错误说"没有相机模式,后退......"。
下面的代码是另一个代码
cameraEnabled: function () {
this.debug('notice', 'Camera enabled');
var cameraApi = this;
if (cameraApi.isCameraEnabled) {
return;
} else {
cameraApi.isCameraEnabled = true;
}
var cams = cameraApi.getCameraList();
for (var i in cams) {
$("#cboCamera").append("<asp:ListItem Value='" + i + "'>" + cams[i] + "</asp:ListItem>");
}
$("#cboCamera").change(function () {
var success = cameraApi.setCamera($(this).val());
if (!success) {
//webcam.debug('error', 'Unable to select camera');
console.log("Failed to set camera");
} else {
//webcam.debug('notice', 'Camera Changed');
console.log("Success set camera");
}
});
该程序不会因为错误而进入此摄像机。 有帮助吗?
答案 0 :(得分:0)
问题解决了。我完全遵循了这个网站http://sshilko.com/examples/jQuery-AS3-Webcam/example.html
错误是我没有使用与网站相同的javascript文件。