我正在尝试在 Windows 8 中制作播放列表。我可以创建播放列表,但 MediElement 不想播放该播放列表。我的问题是:如何.wpl
使用 C# 在 Windows 8 中播放文件?这是我的代码:
async private void PickAudioButton_Click(object sender, RoutedEventArgs e)
{
FileOpenPicker picker = MainPage.CreateFilePicker(MainPage.audioExtensions);
IReadOnlyList<StorageFile> files = await picker.PickMultipleFilesAsync();
MainPage.playlist = new Playlist();
foreach (StorageFile file in files)
{
MainPage.playlist.Files.Add(file);
}
StorageFile savedFile = await MainPage.playlist.SaveAsAsync(KnownFolders.MusicLibrary,
"Sample",
NameCollisionOption.ReplaceExisting,
PlaylistFormat.WindowsMedia);
xcv.SetSource((await savedFile.OpenAsync(FileAccessMode.Read)), ".wpl");
xcv.Play();
MainPage.playlist = null;
}
}