Domanda

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.

È stato utile?

Soluzione 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?

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top