Search code examples
c#winformswebcam.net-7.0mediacapture

How to use MediaCapture.StartPreviewAsync() in a Winforms C# application on .NET 7


I know it's quite common to use MediaCapture.StartPreviewAsync() with MediaCapture in a UWP application, however how do you use it in a Winforms application running on .NET 7?

When I try to call this function, I get this error:

System.Runtime.InteropServices.COMException: Unexpected error in requested operation. (0xC00D36BB)

And apparently this error is caused because I do not use CaptureElement, but that is only available in UWP...

How do I call this function MediaCapture.StartPreviewAsync() in this case?


Solution

  • Answer

    There is no answer to my question, simply because this tool that I want to use is only available for applications on the UWP platform, which is not my case. However, there are possible alternatives that can solve my problem, and they are in the attached links

    Possible Links with Desirable Answers

    MediaCapture API in WPF or Windows Forms

    c# using MediaCapture to show live video captured on a pictureBox in a Form