1

您好我正在尝试创建一个简单的 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 中可以使用的网络摄像头数量是否有限制?

4

2 回答 2

3

似乎我的 USB 带宽用完了,在单独的机器上使用 usb 3 时它开始工作。

于 2013-05-13T11:10:32.470 回答
0

看起来它应该从文档中工作:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html#getCamera()

name:String (default = null) — 指定要获取的相机,由 names 属性返回的数组确定。对于大多数应用程序,通过省略此参数来获取默认摄像头。要指定此参数的值,请使用 Camera.names 数组中从零开始的索引位置的字符串表示形式。例如,要指定数组中的第三个摄像头,请使用 Camera.getCamera("2")

于 2013-05-13T04:05:44.813 回答