[WPF][UWP] MediaPlayerElement. Mfplat.dll exception c0000005 after some time when playing 4k/uhd videos.

stfg1981 1 Reputation point
2021-01-14T09:35:20.277+00:00

Hello,

we have multiple UWP MediaPlayerElements hosted in a WindowsXamlHost in a WPF App.
After some time 4k/UHD Videos are played, our app crashed with a 0xc0000005 error from the MFPlat.dll.

Is there a bug in the MediaPlayerElement or the underlying Windows Media Foundation?

03e3s.png

Universal Windows Platform (UWP)
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,795 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,676 questions
{count} votes

1 answer

Sort by: Most helpful
  1. DaisyTian-1203 11,626 Reputation points
    2021-01-21T08:11:24.977+00:00

    I can't reproduce the error with you code , below is my simple demo to display the 4k video and it runs well.
    The xaml code is:

    <xamlhost:WindowsXamlHost x:Name="myMediaPlayer" InitialTypeName="Windows.UI.Xaml.Controls.MediaPlayerElement" Loaded="myMediaPlayer_Loaded"/>

    The code for myMediaPlayer_Loaded:

     private async void myMediaPlayer_Loaded(object sender, RoutedEventArgs e)  
            {  
                WindowsXamlHost windowsXamlHost = (WindowsXamlHost)sender;  
                Windows.UI.Xaml.Controls.MediaPlayerElement mediaPlayerElement = (Windows.UI.Xaml.Controls.MediaPlayerElement)windowsXamlHost.Child;  
                StorageFile file = await StorageFile.GetFileFromPathAsync(@"C:\Users\daisyt\Videos\4k.mp4");  
                mediaPlayerElement.Source = MediaSource.CreateFromStorageFile(file);  
                mediaPlayerElement.AreTransportControlsEnabled = true;  
                mediaPlayerElement.AutoPlay = true;  
            }  
    

    Could you use my code to create your a MediaPlayerElement to check if it can play your 4k/uhd videos?


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.