KlearTouch / KlearTouch.MediaPlayer

Media Player Element for WinUI 3
MIT License
18 stars 0 forks source link

Adding the MediaPlayerElement directly in XAML causes the sample app to fail to start #1

Closed PierreHenriKT closed 1 year ago

PierreHenriKT commented 2 years ago

Steps to Reproduce

Replace:

https://github.com/KlearTouch/KlearTouch.MediaPlayer/blob/2ed0e62063a6145db68289faee3ddc9042d26ae1/samples/KlearTouchApp.MediaPlayer.WinUI/MainWindow.xaml#L9

With:

    xmlns:controls="using:Microsoft.UI.Xaml.Controls">
    <Grid>
        <controls:MediaPlayerElement x:Name="MediaPlayerElement" AreTransportControlsEnabled="True" />

Actual Behavior

Exception generated at startup:

Microsoft.UI.Xaml.Markup.XamlParseException
  HResult=0x802B000A
  Message=XAML parsing failed.
  Source=WinRT.Runtime
  StackTrace:
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)
   at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)
   at ABI.Microsoft.UI.Xaml.IApplicationStatics.global::Microsoft.UI.Xaml.IApplicationStatics.LoadComponent(Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation)
   at Microsoft.UI.Xaml.Application.LoadComponent(Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation)
   at KlearTouchApp.MediaPlayer.WinUI.MainWindow.InitializeComponent() in C:\...\bld\KlearTouchApp.MediaPlayer.WinUI\obj\x64\Debug\net6.0-windows10.0.19041.0\win10-x64\MainWindow.g.i.cs:line 41

Workaround

Add it from the code-behind.

PierreHenriKT commented 1 year ago

With the release of the official MediaPlayerElement in Win App SDK 1.2, this issue is no longer relevant.