The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

[UWP] Media player, closing, exceptions handling and some others functions RRS feed

  • Question

  • Hi everybody,

    currently I want to move BackgroundMediaPlayer to MediaPlayer object for higher target version. By adapt my code I miss some function, what had old Background Media player:

    - How can I catch MediaPlayer closing, I want to save playing position if for example user closes the app which is running in background? Earlier I could do it with IBackgroundTaskInstance and OnCanclel Event.
    - Is it possible to catch crashes in MediaPlayer, not only MediaFailed Event?
    - How can I close MediaPlayer and create new instance, will be enough to call Dispose and simple create new instance?
    - Earlier it was possible in background task to check resources cost with BackgroundWorkCost.CurrentBackgroundWorkCost, do I need it now, and if yes how it is to use?
    - Maybe it is possible to get or extend background instance and handle necessary cases?


    Monday, September 11, 2017 9:56 AM

All replies

  • Hi neosonne,

    Could you give me more information about your new higher target version app? What function do you want to  implement? Do you still want to use background task in your new app? Do you use the transport control in your app? See the new UWP BackgroundMediaPlayback sample and the document Play media in the background, the new model allows you to implement background audio much more quickly with a significant reduction in code. However, the two-process model is still supported in the current release for backwards compatibility. For more information, see Legacy background audio model.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, September 13, 2017 2:00 AM