0

I'm using this page to keep my audio playing across pages.

<Page
    x:Class="MyApp.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyApp"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:mmppf="using:Microsoft.PlayerFramework"
    mc:Ignorable="d"
    >

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <mmppf:MediaPlayer x:Name="player" AutoPlay="True" AudioCategory="BackgroundCapableMedia" />
        <Frame x:Name="rootFrame"/>
    </Grid>
</Page>

This is how my App Manifest looks. enter image description here

But once I background my app, the audio stops playing. From what I can see, everything mentioned here is present in my app

(the MediaPlayer element should take care of the SystemMediaTransportControls)

Benjamin Diele
  • 1,177
  • 1
  • 10
  • 26

1 Answers1

1

The page you're referring to is only applicable to Windows Store apps, not Windows Phone 8.1.

For Windows Phone 8.1, things seem more complicated, as you have to implement a background task, as explained here: Overview: Background audio (Windows Phone Store apps)

Thierry
  • 342
  • 2
  • 6
  • Isn't a universal app a Store app? Do you know how I'd get the `MediaPlayer` XAML element from my app in the background task? – Benjamin Diele Jul 29 '14 at 14:14
  • A universal app is an app that can be deployed on both Windows and Windows Phone, but that doesn't mean it can use features that do not exist (or work differently) on each platform. – Thierry Jul 29 '14 at 14:19
  • I would suggest you start from this example: http://code.msdn.microsoft.com/windowsapps/BackgroundAudio-63bbc319 – Thierry Jul 29 '14 at 14:20
  • I'm a bit confused as to how I'd get a XAML element from my background task (the MediaPlayer element which needs to be in the visual tree) – Benjamin Diele Jul 29 '14 at 15:37
  • A background task accesses the MediaPlayer using BackgroundMediaPlayer.Current. This is all explained in the links I provided. The architecture to play background audio in Windows Phone 8.1 is entierly different that Windows 8 or previous versions of Windows Phone... – Thierry Jul 29 '14 at 15:48
  • After following that example the audio plays in the background. Thanks! – Benjamin Diele Aug 03 '14 at 17:42