LED&相机总是开启 [英] LED & Camera always ON

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

问题描述

我正在尝试打开设备相机,立即激活该设备的LED灯(Android / iOS)。



我试过了appcelerator ti。媒体事件,但没有工作,这个模块: Ti.Light



在此链接上找到此信息 activate-iphone-4-led-light


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



要更改它,你可以使用Ti。 Media.setCameraFlashMode(PARAM)。



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



不幸的是,你不能启动led并将其用作火炬,你可以
只控制相机闪光灯处理(开,关,自动),而采取
照片。


有任何模块允许使用LED灯吗?



UPDATE 1#: >我正在尝试使用您的ts.camera小部件,其中包含embed相机和flash方法:





但是在pw.custom.androidcamera模块中没有方法switchFlashlight(),此小部件工作?





UPDATE 2#:



为了找到工作流程,我添加了这个手电筒模块,



这是我的index.js文件:

p>

  if(OS_ANDROID){

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

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

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

view = camera.createCameraView();
}

我收到此错误:

  [DEBUG]:CameraViewProxy:相机不可用
[错误]:CameraViewProxy:相机为空。确保
[错误]:CameraViewProxy:< uses-permission android:name =android.permission.CAMERA/>
[错误]:CameraViewProxy:在您的tiapp.xml文件中。

这是我的tiapp.xml文件:

 < 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/>


解决方案

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



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



虽然很可能是启用装置相机会取代对闪光灯的控制。


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

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

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

Hey guys!

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

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

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

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.

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

UPDATE 1#:

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

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

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

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

I'm getting this error:

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

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天全站免登陆