Windows store apps 为什么';我的音频不能在后台播放吗?

Windows store apps 为什么';我的音频不能在后台播放吗?,windows-store-apps,windows-phone-8.1,mmppf,Windows Store Apps,Windows Phone 8.1,Mmppf,我正在使用此页面保持音频在页面间播放 <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.micros

我正在使用此页面保持音频在页面间播放

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

这就是我的应用程序清单的外观。

但一旦我将我的应用程序设置为背景,音频就会停止播放。 从我看到的情况来看,我的应用程序中包含了所有内容


(MediaPlayer的
元素应负责
SystemMediaTransportControls

您所指的页面仅适用于Windows应用商店应用程序,而不适用于Windows Phone 8.1


对于Windows Phone 8.1,事情似乎更复杂,因为您必须执行一项后台任务,如下所述:

通用应用程序不是商店应用程序吗?你知道如何在后台任务中从我的应用程序中获取
MediaPlayer
XAML元素吗?通用应用程序是一种可以在Windows和Windows Phone上部署的应用程序,但这并不意味着它可以使用不存在的功能(或工作方式不同)在每个平台上。我建议您从这个示例开始:我有点困惑如何从我的后台任务中获取XAML元素(需要在可视化树中的MediaPlayer元素)。后台任务使用BackgroundMediaPlayer.Current访问MediaPlayer。这些都在我提供的链接中进行了解释。在Windows Phone 8.1中播放背景音频的架构与Windows 8或以前版本的Windows Phone完全不同。。。