SystemMediaTransportControl GetForCurrentView() 在桌面设备系列 (UWP C#

SystemMediaTransportControl GetForCurrentView() fails in audio background task on Desktop Device Family (UWP C#

我正在尝试将我的 C# WP 8.1 后台音频任务转移到 UWP 并且一切正常,除了尝试使用 Windows.Media.Playback.SystemMediaTransportControls.GetForCurrentView() 获取 UVC 在桌面设备上抛出当前异常:"Could Not Find an appropriate view to be associated with this instance of the MediaPlaybackControl. Please make sure that a view has been initialized". 它只是一种尚未收敛的行为,还是我需要通过桌面 class 设备上的应用程序控制和更新 UVC?

Windows10有API变化,看来应该用BackgroundMediaPlayer.Current.SystemMediaTransportControls。这还没有在文档中。您可以在 Windows 10 示例存储库中找到它:https://github.com/Microsoft/Windows-universal-samples/tree/master/backgroundaudio