how to use front camera using flex4

不想你离开。 提交于 2019-12-08 01:06:31

问题


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);
}

this is the code I have used in my application.


回答1:


try

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();
}

Use getCamera(CameraPosition.FRONT)



来源:https://stackoverflow.com/questions/10629141/how-to-use-front-camera-using-flex4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!