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

[BUG] CameraView doesn't restart preview with Elgato Facecam #2430

Open
2 tasks done
enusbaum opened this issue Jan 7, 2025 · 0 comments
Open
2 tasks done

[BUG] CameraView doesn't restart preview with Elgato Facecam #2430

enusbaum opened this issue Jan 7, 2025 · 0 comments
Labels
bug Something isn't working unverified

Comments

@enusbaum
Copy link

enusbaum commented Jan 7, 2025

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

I've started working with CommunityToolkit.Maui.Camera on my Windows laptop connected to a USB dock for my external devices. When docked, I use an Elgato Facecam (The fist revision, not the newer "Mk. 2") which is USB 1080p60 fixed focal webcam.

My current Maui app is just a simple single page application that has a Picker that enumerates the Available Cameras (as the default is always my laptops integrated webcam). When selecting a new camera from the list of available cameras from the picker, my code changes .SelectedCamera to the CameraInfo? object of the same Name.

Image

        private async void CameraPicker_OnSelectedIndexChanged(object? sender, EventArgs e)
        {
            if (CameraPicker.SelectedIndex == -1)
                return;

            //Stop the camera preview
            MyCamera.StopCameraPreview();

            //Get the name of the selected camera from the picker
            var selectedCameraName = CameraNames[CameraPicker.SelectedIndex];

            //Find the Camera Name from the list of available cameras and set it as the selected camera
            var selectedCamera = (await MyCamera.GetAvailableCameras(CancellationToken.None)).First(camera => camera.Name == selectedCameraName);
            MyCamera.SelectedCamera = selectedCamera;

            //Restart the camera preview
            await MyCamera.StartCameraPreview(CancellationToken.None);
        }

When selecting the Logitech C920, the Image Preview works as intended. When selecting the Elgato Facecam the image preview remains black. When switching back to the Logitech C920 from the Elgato Facecam the Image Preview resumes working as intended.

I've verified the Elgato Facecam itself is initializing properly:

  1. Lights on the webcam indicate it is in use (StartCameraPreview())
  2. When callingCaptureImage() with the Elgato Facecam selected, the captured Image is correct and accurate.
  3. Using webcamtests.com from Firefox confirms the Camera operates as intended

I suspect it might be something weird with the driver, but there's no way to detect something is amiss. The CameraView is reporting that the camera IsAvailable, not IsCameraBusy.

Expected Behavior

I would expect the camera preview on Windows to operate the same for any selected available camera. Currently only the Elgato Facecam will not display a preview in CameraView, while CaptureImage still works properly.

Steps To Reproduce

  1. Open and Run Solution (MauiCameraTest) on Windows
  2. Select Refresh Cameras
  3. Select your Elgato Facecam from the Picker to observe Preview will remain black
  4. Select Capture and observe the captured image is correct
  5. Select another webcam from the Picker
  6. Observe Preview resumes working as intended

Link to public reproduction project repository

https://github.com/enusbaum/MauiCameraTest

Environment

- .NET MAUI CommunityToolkit.Maui.Camera: 2.0.0
- OS: Windows 11 24H2 (Build 26100.2605)
- .NET MAUI: 9.0.21

Anything else?

No response

@enusbaum enusbaum added bug Something isn't working unverified labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unverified
Projects
None yet
Development

No branches or pull requests

1 participant