如何使用FLEX4使用前置摄像头如何使用、摄像头

2023-09-08 13:48:16 作者:喂不饱孤独

我已经开发了Android移动简单的摄像头应用程序使用Flex 4的问题是,当我运行该应用程序,它使用了后置摄像头。它不使用前置摄像头。如何更改摄像头。我需要使用前端摄像头,这个应用程序,请帮帮我吧。

I have developed simple camera application for Android mobile using flex 4. The problem is , when I run that application it uses the rear camera. It's not using the front camera. How can I change the camera. I need to use front side camera for this application , kindly help me .

var camera:Camera = Camera.getCamera(cameraIndex.toString());
if (camera)
{
    var ui: UIComponent = new UIComponent();
    var localVideoDisplay: Video = new Video(180, 135);
    localVideoDisplay.attachCamera(camera);
    ui.addChild(localVideoDisplay);                     
    cameraGroup.addChild(ui);
}

这是在code我已经用在我的应用程序。

this is the code I have used in my application.

推荐答案

尝试

function getCamera( position:String ):Camera
{
    var camera:Camera;
    var cameraCount:uint = Camera.names.length;
    for ( var i:uint = 0; i < cameraCount; ++i )
    {
        camera = Camera.getCamera( String(i) );
        if ( camera.position == position ) 
            return camera;
    }
    return Camera.getCamera();
}

使用 getCamera的(CameraPosition.FRONT)