Luu Thanh
Luu Thanh

Reputation: 15

Custom UI for UWP Background Media Playback

My test app tries to play audio when minimising app, so I selected "Background Media Playback". But when I move my mouse over the App Icon on the Windows Taskbar, Next/Prev/Pause buttons are displayed (see below image). How can I remove them?

Image showing popup window from app taskbar button, with 'previous', 'pause' and 'next' buttons. Also shown is a window with check boxes under the heading 'Capabilities'. The 'background media playback' button is ticked

Upvotes: 1

Views: 120

Answers (1)

Martin Zikmund
Martin Zikmund

Reputation: 39072

You can disable them from the Background task using the IsEnabled property of the SystemMediaTransportControls class.

var controls = BackgroundMediaPlayer.Current.SystemMediaTransportControls;
controls.IsEnabled = false;

Similarly, you can disable them when the app is in the foreground using:

var controls = SystemMediaTransportControls.GetForCurrentView();
controls.IsEnabled = false;

Upvotes: 1

Related Questions