question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CaptureVideoAsync always returning null when using Windows Machine

See original GitHub issue

Description

When trying to capture video running the app as Windows Machine, the video capture method does not show the webcam, and immediately returns null.

private async Task OnCaptureVideoClickedAsync()
        {
            if (await Permissions.CheckStatusAsync<Camera>() != PermissionStatus.Granted)
            {
                var result = await Permissions.RequestAsync<Camera>();
                if (result != PermissionStatus.Granted)
                {
                    ToastService.ShowError("You need to grant the camera permission to use this feature");
                    return;
                }
            }
            var video = await MediaPicker.Default.CaptureVideoAsync();
        }

Permissions are set like this

<Capabilities>
    <rescap:Capability Name="runFullTrust" />
    <DeviceCapability Name="location"></DeviceCapability>
	<DeviceCapability Name="webcam" />
    <DeviceCapability Name="microphone" />
  </Capabilities>

Steps to Reproduce

  1. Create a MAUI Blazor app
  2. Add a button and invoke a method containing. var video = await MediaPicker.Default.CaptureVideoAsync();
  3. Configure the permissions as in the description
  4. Run the app as Windows Machine.

Version with bug

6.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

net6.0-windows10.0.19041.0

Did you find any workaround?

No, haven’t found a workaround.

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
efonsecabcommented, Jun 10, 2022

Seems it is related to this issue and that it’s not a MAUI issue, but instead a WinUI/platform issue https://github.com/dotnet/maui/issues/5849

0reactions
jfversluiscommented, Jul 26, 2022

Duplicate of #7660

Read more comments on GitHub >

github_iconTop Results From Across the Web

net Maui MediaPicker.CaptureVideoAsync returns null for ...
I'm trying to use default media capture tool MediaPicker to shoot ... the function CaptureVideoAsync() always returns Fileresult as a null:.
Read more >
Media picker for photos and videos - .NET MAUI
Learn how to use the IMediaPicker interface in the Microsoft.Maui.Media namespace, to prompt the user to select or take a photo or video....
Read more >
Xamarin.Essentials: Media Picker
CaptureVideoAsync : Opens the camera to take a video. Each method optionally takes in a MediaPickerOptions parameter that allows the Title to be ......
Read more >
MediaPicker.CaptureVideoAsync(MediaPickerOptions) ...
CaptureVideoAsync in the Xamarin.Essentials namespace. ... public static System.Threading.Tasks. ... Essentials.MediaPickerOptions options = null); ...
Read more >
HidDevice.FromIdAsync returns null for my USB keyboard
FromIdAsync always returns null and the corresponding status is DeviceAccessStatus.DeniedBySystem. I can communicate with the keyboard in non- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found