我正在尝试在后台播放声音,但是当我 alt tab 停止播放时,它只会在前台播放...
snd = new MediaElement();
snd.AudioCategory = Windows.UI.Xaml.Media.AudioCategory.BackgroundCapableMedia;
StorageFolder folder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");
StorageFile file = await folder.GetFileAsync("hey.mp3");
var stream = await file.OpenAsync(FileAccessMode.Read);
snd.SetSource(stream, file.ContentType);
snd.Play();