How can we improve the Windows dev platform?

MediaPlayer does not play on calling Play method when app is minimized

I want to start a sound, even when the app is minimized. The play action can be initiated from an App Service (Desktop Bridge). My app has the background audio capability and uses extended execution. So the app is not suspended and keeps running in the background. But if I start a sound using MediaPlayer when the app is minimized, the sound does not play. As soon as I open the app, the sound starts. Minimizing again will not affect the sound: it keeps playing.

2 votes
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

Wim Bokkers shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
Clint Rutkas [MSFT] responded  · 

Asking a clarifying question here, your app (the UWP part) starts minimized and your service tries to play something inside the UWP app via MediaPlayer, correct?

3 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Wim Bokkers commented  ·   ·  Flag as inappropriate

    Some more context: I am using a Desktop Bridge app. The win32 companion app is using a SIP phone library dll (P/Invoke) and communicates through an App Service with the UWP part. The UWP app contains the business logic and UI of our soft phone software. When there's an incoming phone call, the win32 app get's notified by the SIP layer and in turn notifies the UWP app using an App Service connection. The soft phone decides if and what kind of ring tone needs to be played.
    Most of the time our apps does all its work in the background (SIP audio and signaling). This means that playing the ring tone must be done from the background. It is even possible that the UWP app has been auto started and never was in the foreground before.

    As a workaround I will now push the UWP app to the foreground before notifying it about an incoming call. But obviously this is not what we want. Users hate it.

  • Wim Bokkers commented  ·   ·  Flag as inappropriate

    Sorry, I missed your question. Yes, I try to play via MediaPlayer while the app is minimized. The play action is invoked by an App Service from the win32 part.

  • Wim Bokkers commented  ·   ·  Flag as inappropriate

    I also included the extendedExecutionBackgroundAudio capability. This doesn't fix this issue, unfortunately.

Feedback and Knowledge Base