0
我有一個包含媒體文件路徑的列表框。當我從列表框中選擇項目(路徑)它應該在媒體元素中播放... 我該怎麼辦?感謝, Sankar。如何使用Windows應用商店C播放存儲在D驅動器中的媒體文件#
private async void btnLoadPlayList_Click(object sender, RoutedEventArgs e)
{
Windows.Storage.Pickers.FileOpenPicker filePicker = new Windows.Storage.Pickers.FileOpenPicker();
filePicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.VideosLibrary;
filePicker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
filePicker.FileTypeFilter.Clear();
filePicker.FileTypeFilter.Add(".mpeg");
filePicker.FileTypeFilter.Add(".wmv");
filePicker.FileTypeFilter.Add(".mp4");
filePicker.FileTypeFilter.Add(".mkv");
filePicker.FileTypeFilter.Add(".3gp");
IReadOnlyList<Windows.Storage.StorageFile> fileList = await filePicker.PickMultipleFilesAsync();
if (fileList.Count > 0)
{
foreach (StorageFile file in fileList)
{
lstPlayList.Items.Add(file.Path);
}
}
}
private async void lstPlayList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
PlayerME2.Source = new Uri(lstPlayList.SelectedItem.ToString());
}
如果我像這樣設置源碼,然後嘗試播放,則會顯示Error E Access Denied Exception。告訴我一些設置來源並播放選定文件的內容。
向我們展示你玩得那麼遠的東西,.. – Kumar
是這使得任何意義@ kumar-我爲嚴重的新本。以某種方式幫助。謝謝 – user3184500
這裏同樣的事情.. [http://stackoverflow.com/questions/18322242/read-the-value-of-an-item-in-a-listbox?answertab=votes#tab-top] – Kumar