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

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?

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top