LED & Camera always ON

主宰稳场 提交于 2019-12-12 00:01:57

问题


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:

  • github - ts.camera
  • gittio - ts.camera

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

  • github - Ti-Android-CameraView
  • gittio - pw.custom.androidcamera

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

回答1:


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.



来源:https://stackoverflow.com/questions/36896617/led-camera-always-on

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