我正在使用此页面来保持我的音频跨页面播放。
<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>
这就是我的 App Manifest 的外观。
但是,一旦我背景化我的应用程序,音频就会停止播放。据我所知,这里提到的所有内容都存在于我的应用程序中
(该MediaPlayer
元素应该照顾SystemMediaTransportControls
)