0

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.

w.b
  • 11,026
  • 5
  • 30
  • 49

2 Answers2

1

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

BADWOLF
  • 47
  • 9
0

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?

Jerry Nixon
  • 31,313
  • 14
  • 117
  • 233