LED &相机始终开启 [英] LED & Camera always ON

查看:26
本文介绍了LED &相机始终开启的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试打开设备摄像头并立即激活该设备 (android/iOS) 的 LED 灯.

I'm trying to open the device camera an activate immediately the LED light of that device (android/iOS).

我已经尝试了 appcelerator ti.media 事件,但没有奏效,这个模块也没有:Ti.光.

I've tried the appcelerator ti.media events but didn't work, neither this module: Ti.Light.

在这个链接上找到这个 activate-iphone-4-led-光

Found this on this link activate-iphone-4-led-light

大家好!

对于 flash 的东西,你必须检查属性:Ti.Media.cameraFlashMode(区分大小写)

For the flash stuff you have to check the property: Ti.Media.cameraFlashMode (case sensitive)

你可以使用 Ti.Media.setCameraFlashMode(PARAM) 来改变它.

To change it you can use Ti.Media.setCameraFlashMode(PARAM) .

PARAM 可以是:Ti.Media.CAMERA_FLASH_OFF、Ti.Media.CAMERA_FLASH_ON、Ti.Media.CAMERA_FLASH_AUTO

PARAM could be: Ti.Media.CAMERA_FLASH_OFF , Ti.Media.CAMERA_FLASH_ON, Ti.Media.CAMERA_FLASH_AUTO

不幸的是你不能启动led并将其用作手电筒,你可以仅在拍摄时控制相机闪光灯处理(开、关、自动)照片.

Unfortunately you can’t start the led and use it as a torch, you can only control the camera flash handling (on, off, auto) while taking a photo.

有什么模块可以一直使用led灯?我只是在相机打开时需要这个.

There is any module that allow to use the led light all the time? I just need this while the camera is opened.

更新 1#:

我正在尝试使用具有嵌入相机和闪光灯方法的 ts.camera 小部件:

I’m trying to use your ts.camera widget, that have the embed camera and flash methods:

但是pw.custom.androidcamera"模块中没有方法switchFlashlight(),这个widget能用吗?

But there is no method switchFlashlight() in "pw.custom.androidcamera" module, this widget works?

更新 2#:

为了找到解决办法,我添加了这个手电筒模块,我试图在展示相机之前或之后调用它,但我认为不可能同时进行 2 个相机活动.

In order to find a workaroud, I've added this flashlight module, and I'm trying to call it before or after showing the camera, but I think that it's not possible to have 2 camera activities at the same time.

这是我的 index.js 文件:

This is my index.js file:

if(OS_ANDROID) {

    flash = require('dk.napp.flashlight');

    if(!flash.isFlashLightOn()) flash.turnFlashLightOn();

    camera = require('pw.custom.androidcamera');

    view = camera.createCameraView();
}

我收到此错误:

[DEBUG] :  CameraViewProxy: Camera not available
[ERROR] :  CameraViewProxy: Camera is null. Make sure
[ERROR] :  CameraViewProxy:     <uses-permission android:name="android.permission.CAMERA" />
[ERROR] :  CameraViewProxy: is in you tiapp.xml file.

这是我的 tiapp.xml 文件:

This is my tiapp.xml file:

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<uses-feature android:name="android.hardware"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera2"/>
<uses-feature android:name="android.hardware.camera2.params"/>
<uses-feature android:name="android.hardware.camera.flash"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>

推荐答案

这两个模块可能会完成这项工作:

These two modules might do the job:

http://gitt.io/search?q=flash

虽然很可能激活设备相机会覆盖对闪光灯的控制.

Although it could well be that activating the device camera will override the control over the flash light.

这篇关于LED &amp;相机始终开启的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆