Windows 8.1 background audio - what's the way to show SystemMediaTransportControls

705 views Asked by At

I try to build a Windows 8.1 app with background audio, and when the app goes off screen the music is ok, but no SystemMediaTransportControls shows although I set it in code:

SystemMediaTransportControls smtc;

public MainPage()
{
    this.InitializeComponent();
    mediaElement.AudioCategory = AudioCategory.BackgroundCapableMedia;

    smtc = SystemMediaTransportControls.GetForCurrentView();
    smtc.IsPauseEnabled = true;
    smtc.IsPlayEnabled = true;
    smtc.ButtonPressed += smtc_ButtonPressed;
}

I have a computer with a standard keyboard and mouse.

2

There are 2 answers

0
Jerry Nixon On BEST ANSWER

Hmm, that's not what I am seeing. Doing this:

<Grid Background="Black">

    <MediaElement
        Source="http://media.ch9.ms/ch9/f271/c9225442-2e4f-452d-ac78-f93b92eef271/DevRadioWinPhoneMultitasking_mid.mp4"
        AreTransportControlsEnabled="True" />

</Grid>

The controls are visible, but they aren't visible when I navigate away from the app.

Am I missing something?

0
BADWOLF On

you should enable them from a windows runtime component, doing a background task and enabling them in Run function enabling also background point from the manifest. Otherwise they will be killed if you navigate away from the app or frame