Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getSupportedFlashModes returns array empty in Android 14 SDK 34 #345

Open
danielcollione opened this issue Sep 24, 2024 · 1 comment · May be fixed by #360
Open

getSupportedFlashModes returns array empty in Android 14 SDK 34 #345

danielcollione opened this issue Sep 24, 2024 · 1 comment · May be fixed by #360
Assignees
Labels
bug Something isn't working

Comments

@danielcollione
Copy link

danielcollione commented Sep 24, 2024

In our project we found a bug that when starting the camera in its rear mode and using the getSupportedFlashModes method we received an array of all available values: off, auto, on, and torch.
When using the flip() method to access the front camera and using flip() again to return to the rear, using the method again the array comes empty.
And if I try to use the setFlashMode method, the application fails even though the cell phone initially supports Flash.
We performed the test on a physical Android 14 device.

I would like to know if this is really a bug or is there any recommendation for using the following plugin?

Versions:

  • Android 14 (SDK 34)
  • Capacitor 5
  • Ionic/Angular 7
  • CameraPreview: 5
  • Angular 16
  • Model: Samsung A54
  • ChromeVersion: 128.0.6613.147
  • Gradle: 8.7

image
image

@danielcollione danielcollione changed the title getSupportedFlashModes returns null in Android 14 SDK 34 getSupportedFlashModes returns array empty in Android 14 SDK 34 Sep 24, 2024
@ryaa ryaa self-assigned this Dec 16, 2024
@ryaa ryaa added the bug Something isn't working label Dec 16, 2024
ryaa added a commit that referenced this issue Dec 18, 2024
#345

Changes:
- implemented the fix to flip/switch between the main front and back cameras and avoid switching to additional cameras
@ryaa
Copy link
Member

ryaa commented Dec 18, 2024

@danielcollione I confirm the problem. The problem is that the number might not be limited to just the front and back cameras because modern smartphones often come with more than two cameras. If there are more then 2 cameras (for example, on my Samsung A53 there are 4 cameras total) the flip iterates/switches through all the available cameras, so if flip was invoked twice and there were more then 2 cameras available , the second flip did not return to the initial camera. However, if you flip as many times as cameras available on the device, you will be able to get the flash modes as expected.

This PR should fix the problem #360 as this will flip/switch between the main back/front cameras. Can you please check if the fix works as expected and I will release the new build v6.0.2 with the required fix.

Here are somehow related issue #256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants