Skip to content

[BUG] CommunityToolkit.Maui.Camera preview on Windows 11 blinks and is on greyscale #2547

Closed

Description

@veikkoeeva

Is there an existing issue for this?

  • I have searched the existing issues

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

Current Behavior

The camera preview on Windows 11 (latest) is in grayscale and blinks.

Expected Behavior

The camera preview shows normally on Windows.

Steps To Reproduce

  1. Clone https://github.com/jonathanpeppers/MyPal (or use Maui Toolkit samples).
  2. Compile and run on Windows (ensure permissions are given to microphone, camera).

Link to public reproduction project repository

https://github.com/jonathanpeppers/MyPal

Environment

- CommunityToolkit.Maui.Camera: 2.0.2
- OS: Windows 11 (latest as of this writing).
- .NET MAUI: (latest)

Anything else?

Camera.Glitch.mp4

Linked is a short capture of MyPal showing a piece of a table and a keyboard. The camera preview is in greyscale and blinking. Might have something to do with camera parameters (exposure?). I was using Logitech Brio 4k and it it had red light blinking, indicating the IR light is in use.

Activity

  1. dotMorten commented on Feb 20, 2025

    @dotMorten
    Contributor

    If it is indeed using the IR camera, I'm guessing Maui just picks the wrong camera stream? My guess is this code just needs a little tweaking:

    CameraPosition position = CameraPosition.Unknown;
    var device = deviceInfoCollection.FirstOrDefault(deviceInfo => deviceInfo.Id == sourceGroup.Id);
    if (device?.EnclosureLocation is not null)
    {
    position = device.EnclosureLocation.Panel switch
    {
    Panel.Front => CameraPosition.Front,
    Panel.Back => CameraPosition.Rear,
    _ => CameraPosition.Unknown
    };
    }
    var mediaEncodingPropertiesList = mediaCapture.VideoDeviceController.GetAvailableMediaStreamProperties(MediaStreamType.Photo)
    .OfType<ImageEncodingProperties>().OrderByDescending(p => p.Width * p.Height);

  2. TheCodeTraveler commented on Feb 20, 2025

    @TheCodeTraveler
    Collaborator

    Interesting! Thanks @dotMorten!!

    Do you have experience with this on Windows? Any chance you could open up a PR to help us out?

  3. bijington commented on Feb 20, 2025

    @bijington
    Contributor

    I have a laptop with an IR camera. I could take a look if it helps

  4. dotMorten commented on Feb 20, 2025

    @dotMorten
    Contributor

    I also have the specific camera and I could try it if you can't reproduce. I have a little bit of experience with these APIs yes.

  5. dotMorten commented on Feb 21, 2025

    @dotMorten
    Contributor

    I can reproduce, and I see this camera is detectable:

    Image

  6. locked and limited conversation to collaborators on Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Camera 📸Issue/PR associated with the Camera packagebugSomething isn't workingunverified

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions