Raj A.N.T. Gounder
Raj A.N.T. Gounder

Reputation: 500

Accessing front camera of mobile using flash?

Recently I went thru the code for accessing the camera using flash ActionScript3 and I have tested the code in iMac machine, iPhone and Android.
Now based on this, I am developing an application for Android which includes the accessibility of the front camera.

Now my Problem is I dont know how to access the front camera?
We should use some other code or should we specify which camera should be accessed?
First of all, can we access the front camera thru flash?

Upvotes: 0

Views: 4960

Answers (3)

citizen conn
citizen conn

Reputation: 15390

Note: This answer is outdated. Please refer to the other answers for updated information.

Currently, AIR only supports access to the primary camera on an Android device.

http://forums.adobe.com/thread/849983

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

"On Android devices, you can only access the rear-facing camera."

Upvotes: 0

polyrhythmm
polyrhythmm

Reputation: 21

Not true. You can access the front camera on Android.

The only problem is that you don't get to use the CameraUI(pretty sure).

var camera = Camera.getCamera("1");
camera.setMode(stage.stageWidth, stage.stageHeight, 30, true);
var video:Video = new Video(stage.stageWidth, stage.stageHeight);
video.attachCamera(camera);
addChild(video);

Upvotes: 2

terbooter
terbooter

Reputation: 399

I made a simple android app. Here is the code for selecting camera window

public class SelectCameraAlertAndroid extends StartAlertAndroid_design{

        public function SelectCameraAlertAndroid() {
            frontCameraButton.addEventListener(MouseEvent.CLICK, onFrontCamera);
            backCameraButton.addEventListener(MouseEvent.CLICK, onBackCamera);
        }

        private function onFrontCamera(event:MouseEvent):void {
            Model.model.camera = Camera.getCamera("1");
            Model.model.cameraSelectedSignal.dispatch();
            dispatchEvent(new Event("closeMe"));
        }

        private function onBackCamera(event:MouseEvent):void {
            Model.model.camera = Camera.getCamera("0");
            Model.model.cameraSelectedSignal.dispatch();
            dispatchEvent(new Event("closeMe"));
        }
    }

Upvotes: 2

Related Questions