Question

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.

Was it helpful?

Solution 2

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?

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top