使用闪光灯访问手机前置摄像头?

发布于 2024-11-16 04:01:56 字数 214 浏览 3 评论 0原文

最近,我研究了使用 Flash ActionScript3 访问相机的代码,并在 iMac 机、iPhone 和 Android 上测试了该代码。
现在基于此,我正在开发一个 Android 应用程序,其中包括前置摄像头的可访问性.

现在我的问题是我不知道如何访问前置摄像头?
我们应该使用其他代码或者我们应该指定应该访问哪个相机?
首先,我们可以通过闪光灯访问前置摄像头吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

自由如风 2024-11-23 04:01:56

我做了一个简单的安卓应用程序。这是选择相机窗口的代码

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

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"));
        }
    }
臻嫒无言 2024-11-23 04:01:56

不正确。您可以在 Android 上访问前置摄像头。

唯一的问题是你无法使用 CameraUI(非常确定)。

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

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);
給妳壹絲溫柔 2024-11-23 04:01:56

注意:此答案已过时。请参阅其他答案以获取更新信息。

目前,AIR 仅支持访问 Android 设备上的主摄像头。

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

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

"在 Android 设备上,您只能访问后置摄像头。”

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."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文