我想建立一个页面来检测用户的相机/麦克风是否与此类似:http ://www.tokbox.com/user-diagnostic/
我只需要指导从哪里开始。
谢谢!
这个 jQuery 插件可以为您提供用户拥有的可用网络摄像头列表:
http://www.xarg.org/project/jquery-webcam-plugin/
如果webcam.getCameraList().length == 0
那样,您就会知道他们没有网络摄像头。
在闪存中你可以使用
var cam:Camera = Camera.getCamera();
if (cam == null)
{
trace("User has no cameras installed.");
}
else
{
trace("User has at least 1 camera installed.");
}
试试这个..获取网络摄像头的访问权限
$(function(){
//initialize camera in browser
$("#camera").webcam({
width: 320,
height: 240,
mode: "callback",
swffile: "jscam_canvas_only.swf",
onTick: function() {},
onSave: function() {},
onCapture: function() {},
debug: function() {},
onLoad: function() {}
});
});
var test;
test = function(){
var tester = false;
//try catch block for tight binding
try{
//condition if length is 0 or undefined
if(webcam.getCameraList().length == 0){
alert('You dont have a camera');
return;
}else{
alert("cam detected");
return;
}
tester = true;
}catch(e){
tester = false;
setTimeout(test,1000);
}
}
setTimeout(test,1000);
</script>
<div id="camera" style="opacity:0"></div>
我最终建立了自己的东西。
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Microphone.html
I detected the camera number and the microphone number and pass it back to Javascript using ExternalInterface.
Works like a charm.