网络摄像头/麦克风检测

时间:2012-10-14 20:21:14

标签: jquery actionscript-3 flash camera microphone

我想构建一个页面来检测用户的相机/麦克风是否与此类似:http://www.tokbox.com/user-diagnostic/

我只需要指导从哪里开始。

谢谢!

4 个答案:

答案 0 :(得分:1)

此jQuery插件可以为您提供用户拥有的可用网络摄像头列表:

http://www.xarg.org/project/jquery-webcam-plugin/

如果webcam.getCameraList().length == 0,那么您就会知道他们没有网络摄像头。

答案 1 :(得分:1)

在flash中你可以使用

 var cam:Camera = Camera.getCamera(); 
if (cam == null) 
{ 
    trace("User has no cameras installed."); 
} 
else 
{ 
    trace("User has at least 1 camera installed."); 
}

答案 2 :(得分:1)

尝试此..以访问网络摄像头                    

$(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>

答案 3 :(得分:1)