Description
openedon Jun 24, 2024
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
- 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. - Clone and execute WinUI 3 test project from https://github.com/whiskhub/WinUi3_MediaCapture_MediaPlayer_Bug
- Select webcam with unsupported subtype (e.g. FineCam with RGB24 subtype format)
- 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.
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.