在FlashCom中检测摄像头和麦克风的方法
//检查摄像头
function CheckForCam() {
camArray = Camera.names;
if (camArray.length >= 1){
temp_cam = Camera.get();
if(temp_cam == -1) {
trace('--- cam is detected but its busy');
return -1; }
else {
trace('--- cam detected');
return 1; }
delete temp_cam;
} else if (camArray.length == 0) {
trace('--- no cam detected');
return 0;
}
}
// 检查麦克风
function CheckForMic() {
micArray = Microphone.names;;
if (micArray.length >= 1){
temp_mic = Microphone.get();
if(temp_mic == -1) {
trace('--- mic is detected but its busy');
return -1; }
else {
trace('--- mic detected');
return 1; }
delete temp_mic;
} else if (micArray.length == 0) {
trace('--- no Mic detected');
return 0;
}
}
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步