Vincent
Vincent

Reputation: 3304

How to add tranport control button to taskbar preview window

I'm using MediaPlayerElement, and I want to add Play/Pause/Next....button to taskbar preview window, as the following picture shows.

I tried the following answer, sadly it doesn't work. I also tried doc, doesn't work either.

enter image description here

My following code is

MediaPlayer player = new MediaPlayer();
var source = MediaSource.CreateFromUri(new Uri("ms-appx:///Assets/elephantsdream-clip-h264_sd-aac_eng-aac_spa-aac_eng_commentary-srt_eng-srt_por-srt_swe.mkv"));
player.Source = source;
player.MediaOpened += Player_MediaOpened;
MyPlayer.SetMediaPlayer(player);

//var systemMediaTransportControls = player.SystemMediaTransportControls;
var systemMediaTransportControls = SystemMediaTransportControls.GetForCurrentView();
systemMediaTransportControls.IsPlayEnabled = true;
systemMediaTransportControls.IsPauseEnabled = true;
systemMediaTransportControls.ButtonPressed += SystemMediaTransportControls_ButtonPressed;

Upvotes: 0

Views: 106

Answers (1)

Nico Zhu
Nico Zhu

Reputation: 32785

Derive from your screenshot, we can find the control button on the taskbar preview. And there are system level, if we enable the Background Media Playback capability in the packagemanifest file, the buttons will display.

Upvotes: 1

Related Questions