Closed gbrits closed 1 year ago
I'd like to note, the log did show up that my [test] phone had a torch / flash unit. I guess it's just like the underlying Camera API's gripe used to be of the camera already being in use (due to intent usage).
Hi @gbrits
I can't implement an option to enable flash at the moment (Android and IOS), I'm pretty busy, but this changes works on my devices.
try {
cameraProvider.unbindAll()
+ val camera = cameraProvider.bindToLifecycle(
- cameraProvider.bindToLifecycle(
viewLifecycleOwner,
cameraSelector,
videoCapture,
preview
)
+
+ if (camera.cameraInfo.hasFlashUnit()) {
+ Log.i(TAG, "Enable torch");
+ camera.cameraControl.enableTorch(true)
+ } else {
+ Log.e(TAG, "No torch available");
+ }
} catch (exc: Exception) {
// we are on main thread, let's reset the controls on the UI.
Log.e(TAG, "Use case binding failed", exc)
Can you share logcat output?
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Hi there, great new package (the utilisation of CameraX) this is an opportunity for the Capacitor community to have a great video package - which is woefully needed / missing from the Ionic ecosystem for some reason?
In my particular use-case I need the flash to be on automatically. Could you steer me in the right direction? I tried adding this code to the
bindCaptureUsecase()
method inside of theCaptureFragment.kt
to no avail.