Flashlight-PhoneGap-Plugin
Flashlight-PhoneGap-Plugin copied to clipboard
Is this plugin really working?
I'm trying this plugin on an iphone 6s running iOS 14.7.1, but I am not able to turn on the flashlight. There is no error thrown by the code, it acts like everything is ok, but still no flashlight comes on.
During the build I see some deprecated messages, complaining about:
/Users/user/Software/project/platforms/ios/test/Plugins/cordova-plugin-flashlight/Flashlight.m:45:17: 'setFlashMode:' is deprecated: first deprecated in iOS 10.0 - Use AVCapturePhotoSettings.flashMode instead.
and
/Applications/Xcode-13.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.5.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDevice.h:837:41: Property 'flashMode' is declared deprecated here
I would suggest you change plugin to one that is more actively developed, i.e. community-cordova-plugin-flashlight
(current version is 3.3.3), see community-cordova-plugin-flashlight.
Let me know what you think after you have tested it, thanks.
@minduch I'm seeing the same behavior with community-cordova-plugin-flashlight. On Android it doesn't work either.
Are there any permissions I have to provide ?
I would report the problem in that plugin too.
Message ID: @.***>
Yes, you need the Camera access on iOS.
You probably need it for Android too. You can try our app iiziRun Developer
with flashlight manipulations under Settings
.
I am granting already the camera permission in both ios and android. The camera works, is just the flashlight that doesn't work when using this plugin. As for reporting a problem under community-cordova-plugin-flashlight, i can't because there is no issues section available there.
In android I am able to start the flashlight from javascript. But in ios this is not supported. That is way I was trying this plugin. But it seems it doesn't work properly
Hmm it seems that the reason this plugin doesn't work properly (at least in android) is because I already have the camera running by another user (webview browser in my end).
android.hardware.camera2.CameraAccessException: CAMERA_IN_USE (4): setTorchMode:2031: Torch for camera "0" is not available due to an existing camera user
For some reasons the plugin doesn't pop up these errors in the callback. I can only see them if I debug the plugin.
It seems that this plugin only works if the camera is not in use. Which is not my case. I need the camera running and the torch to be enabled/disabled per user preference. So to answer my initial question: This plugin, partially works.