AS3多个网络摄像头未显示第3个网络摄像头

时间:2013-05-12 18:35:57

标签: actionscript-3 flash flex flash-builder webcam

您好我正在尝试创建一个简单的AIR 3应用程序,在舞台上显示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中可以使用的网络摄像头数量是否有限制?

2 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:0)

看起来它应该可以在docs中使用:

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”)