CommunityToolkit / Maui

The .NET MAUI Community Toolkit is a community-created library that contains .NET MAUI Extensions, Advanced UI/UX Controls, and Behaviors to help make your life as a .NET MAUI developer easier
https://learn.microsoft.com/dotnet/communitytoolkit/maui
MIT License
2.23k stars 387 forks source link

[BUG] CameraView IsTorchOn not working on Android #1992

Open jfversluis opened 3 months ago

jfversluis commented 3 months ago

Is there an existing issue for this?

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

Setting the IsTorchOn to true does not have any effect at least on Android. I have been testing Android 12, on a physical Samsung Galaxy S10e. Didn't test any other platforms yet.

Expected Behavior

The flashlight turns on and can be used as a torch

Steps To Reproduce

  1. Add CameraView to your project
  2. Set IsTorchOn in XAML to true
  3. Alternatively set IsTorchOn to true from code
  4. In both cases it does not have any effect when deployed to the device

Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui

Environment

- .NET MAUI CommunityToolkit Camera: 1.0.2
- OS: Android 12
- .NET MAUI: 8.0.61

Anything else?

No response

zhitaop commented 3 months ago

As mentioned in https://github.com/CommunityToolkit/Maui/pull/1758, the foundation of this PR is based on https://github.com/CommunityToolkit/Maui/pull/1080, where IsTorchOn was initially added. However, this property has not actually been implemented in any of the supported platforms yet, therefore setting it would have no effect. This is reflected in CameraViewHandler where no PropertyMapper for IsTorchOn is defined.

On a side note, the same situation applies to IsCameraBusy as well, where it doesn't actually reflect the status of the CameraView.

jfversluis commented 3 months ago

Oooh thanks! I missed that. Yeah so lets make sure to implement those then I guess 😄

CodingOctocat commented 3 months ago

Flash on/auto And it won't work.

zhitaop commented 3 months ago

@jfversluis No worries and thanks for catching this! I completely forgot about these unimplemented features in the PR and just let them sneak in to the release... I guess the maintainer team can decide if we should temporarily remove them in a new release until they are properly implemented?