MicrosoftDocs / winrt-api

WinRT reference content for developing Microsoft Universal Windows Platform (UWP) apps
Creative Commons Attribution 4.0 International
227 stars 493 forks source link

Add Guidance to MediaPlayerElement on How to Properly Close Underlying MediaPlayer #2464

Closed evanwilliams26 closed 3 months ago

evanwilliams26 commented 3 months ago

We've run into multiple instances of 3rd party apps improperly closing the MediaPlayer when it's disconnected from the MediaPlayerElement. Specifically, they dispose of the source while it's still active on the MediaPlayer resulting in fatal MF_E_SHUTDOWN errors. Added guidance on how to correctly disconnect the MediaPlayer from the MediaPlayerElement and dispose of the MediaPlayer and Source.

Added some missing details on how the MediaPlayer responds differently depending on whether MediaPlayerElement creates it and some nuances with how the underlying MediaPlayer can get out of sync with MediaPlayerElement properties.