谁能帮助我了解如何使用UWP MediaElement.SetPlaybackSource?
我通过了this链接,但是无法弄清/理解此方法的用法。在MSDN或Web上的其他地方也未提供任何示例。谢谢!
最佳答案
//Create a new picker
var filePicker = new Windows.Storage.Pickers.FileOpenPicker();
//Add filetype filters. In this case wmv and mp4.
filePicker.FileTypeFilter.Add(".wmv");
filePicker.FileTypeFilter.Add(".mp4");
filePicker.FileTypeFilter.Add(".mkv");
//Set picker start location to the video library
filePicker.SuggestedStartLocation = PickerLocationId.VideosLibrary;
//Retrieve file from picker
StorageFile file = await filePicker.PickSingleFileAsync();
if (file != null)
{
mediaSource = MediaSource.CreateFromStorageFile(file);
mediaElement.SetPlaybackSource(mediaSource);
}
关于c# - 如何使用MediaElement.SetPlaybackSource,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37573641/