您好我正在尝试创建一个简单的 AIR 3 应用程序,在舞台上显示 3 个网络摄像头。出于某种原因,第三个网络摄像头不想显示,它甚至没有打开网络摄像头上的 LED 指示灯。
我尝试了多个网络摄像头,例如。微软、罗技、内置......
以下代码不起作用:
var videoWidth:int = 1000 / totalCols;
var videoHeight:int = 800 / totalRows;
for (var i:int = 0; i < Math.min(Camera.names.length, totalRows * totalCols); i++) {
var currRow:int = Math.floor(i / totalCols);
var currCol:int = i % totalCols;
var video:Video = new Video(videoWidth, videoHeight);
var cam:Camera = Camera.getCamera(i.toString());
if (cam) {
cam.setMode(videoWidth, videoHeight, 30);
video.attachCamera(cam);
video.x = currCol * videoWidth;
video.y = currRow * videoHeight;
StageObj.addChild(video);
}
}
这也不是:
//camera settings
track_cam = new Camera();
track_cam = Camera.getCamera("1");
track_cam.setMotionLevel(100);
track_cam.setQuality(0, 100);
track_cam.setMode(1920, 1080, 30);
track_feed = new Video();
track_feed.width = track_cam.width;
track_feed.height = track_cam.height;
track_feed.smoothing = true;
track_feed.attachCamera(track_cam);
StageObj.addChild(track_feed);
player_one_cam = new Camera();
player_one_cam = Camera.getCamera("2");
player_one_cam.setMotionLevel(100);
player_one_cam.setQuality(0, 100);
player_one_cam.setMode(200, 200, 30);
player_one_feed = new Video();
player_one_feed.width = player_one_cam.width;
player_one_feed.height = player_one_cam.height;
player_one_feed.smoothing = true;
player_one_feed.attachCamera(player_one_cam);
StageObj.addChild(player_one_feed);
player_one_feed.x = 500;
player_one_feed.y = 500;
player_two_cam = new Camera();
player_two_cam = Camera.getCamera("0");
player_two_cam.setMotionLevel(100);
player_two_cam.setQuality(0, 100);
player_two_cam.setMode(200, 200, 30);
player_two_feed = new Video();
player_two_feed.width = player_two_cam.width;
player_two_feed.height = player_two_cam.height;
player_two_feed.smoothing = true;
player_two_feed.attachCamera(player_two_cam);
StageObj.addChild(player_two_feed);
在 AS3 中可以使用的网络摄像头数量是否有限制?