Phonegap Plugins: Using camera with flashlight on

Asked

Viewed 2,883 times

2

I need to know if it is possible or if there is a plugin that allows me to open the camera with the flash(or flashlight) on(a). I need this for a project, to check the location of the flash overflow. I have tried several ways, using the camera plugin itself cordova along with the Flash plugin (Eddyverbruggen), but error on the camera when turning on the flash. Any solution?

Picture of error while accessing camera with flash on: inserir a descrição da imagem aqui

  • Welcome. It’s not because you’re trying to turn on the flash on a device without this feature? It would help if [Edit] the question and include the error shown.

  • Thanks re22, already edited. No, I’m trying to turn on my device, which has flash(flashlight).

  • try the free camera flash app

1 answer

1

Look, your question has become too general, it is not possible to find out for sure what error 3 is. Probably if you look at the log on adb there must be more information about the error, anyway I did a quick read of the code of the plugin used (Eddyverbruggen/Flashlight-Phonegap-Plugin) and I realized that the plugin uses the camera to fix a problem with Nexus 5 (besides using in a function to give toggle in flash).

The problem is that it only gives a release of the camera after receiving an action to turn off the flash. I believe that is why it is possible to see the Toast camera-blind.

Anyway make modifications to the plugins(s) is quite complicated, even more if you are using Cordova to avoid Java, in this case the best solution is to use a plugin that better meets your need. Luckily with a search of 5minutes in Google I found the plugin below that allows to take photos and activate the flash without problems. Now you have the freedom to use all plugins and switch between them for the most different actions.

https://github.com/donaldp24/CanvasCameraPlugin

  • Hello Pedro Henrique, I checked this plugin Canvas, really has the option to turn on and off flash and take photo, however, the same does not work, there must be some error with this plugin, because by adding it, my project no longer runs.

  • @Evertonmartins You can send an adb log?

  • After a century, I checked this plugin and has the options AUTO/ON/OFF, which I think is not what I wanted, because I wanted something that left the continuous flash, even before focusing or taking the photo.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.