microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.16k stars 668 forks source link

MediaCapture + WinUI 3 MediaPlayerElement doesn't support same subtype formats as WinUI 2 CaptureElement #9756

Open whiskhub opened 2 weeks ago

whiskhub commented 2 weeks ago

Describe the bug

As CaptureElement is not available in WinUI 3, the official workaround is to use a MediaPlayerElement instead (#4710). This works in most cases, but not all.

Some webcam video subtype formats, which were supported by WinUI 2 CaptureElement, are not supported by the MediaPlayerElement approach in WinUI 3. The video feed just stays blank, and the MediaPlayerElement stays in "Paused" state. This causes problems if some webcams only support the affected video format and can't switch to another one like NV12.

Affected video formats (possibly incomplete): RGB24, UYVY ({59565955-0000-0010-8000-00AA00389B71}), I420 ({30323449-0000-0010-8000-00AA00389B71})

Porting CaptureElement to WinUI 3 would be one solution (#8214) to fix this regression from WinUI 2.

Steps to reproduce the bug

  1. Make sure to have a webcam with one of the unsupported formats connected !! You can also install FineCam from the Microsoft Store, which will create a virtual webcam in RGB24 format. Open the FineCam app and press the blue button "start virtual webcam" in the bottom right corner.
  2. Clone and execute WinUI 3 test project from https://github.com/whiskhub/WinUi3_MediaCapture_MediaPlayer_Bug
  3. Select webcam with unsupported subtype (e.g. FineCam with RGB24 subtype format)
  4. MediaPlayerElement stays blank, no video preview

Expected behavior

MediaPlayerElement shows video preview, just as with other subtype formats like NV12; or the CaptureElement from WinUI 2.

Screenshots

The bottom area, where the MediaPlayerElement is, stays blank. image

NuGet package version

WinUI 3 - Windows App SDK 1.5.4: 1.5.240607001

Windows version

Windows 11 (22H2): Build 22621

Additional context

The Windows Settings app still uses WinUI 2 and a CaptureElement preview in "Bluetooth and devices -> Cameras", where you can also verify that CaptureElement works fine.

github-actions[bot] commented 2 weeks ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.