求助:mediaelement和listview制作播放列表问题
不多说,上代码
FileOpenPicker picker = new FileOpenPicker(); //实例化一个FileOpenPicker
// 添加文件类型过滤,如.mp4,.avi等
picker.FileTypeFilter.Add(".mp4");
// 设置初始路径
picker.SuggestedStartLocation = PickerLocationId.VideosLibrary;
// PickMultipleFilesAsync是选取多个文件,
// PickSingleFileAsync选取单个文件
StorageFile file = await picker.PickSingleFileAsync();
if (file != null)
{
var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite);
media.SetSource(stream, file.ContentType);
media.Play();
}
我想让FileOpenPicker选择的文件添加进listview里面,然后点击listview实现播放视频,应该怎么写
FileOpenPicker picker = new FileOpenPicker(); //实例化一个FileOpenPicker
// 添加文件类型过滤,如.mp4,.avi等
picker.FileTypeFilter.Add(".mp4");
// 设置初始路径
picker.SuggestedStartLocation = PickerLocationId.VideosLibrary;
// PickMultipleFilesAsync是选取多个文件,
// PickSingleFileAsync选取单个文件
StorageFile file = await picker.PickSingleFileAsync();
if (file != null)
{
var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite);
media.SetSource(stream, file.ContentType);
media.Play();
}
我想让FileOpenPicker选择的文件添加进listview里面,然后点击listview实现播放视频,应该怎么写
...全文
相关推荐
WPF MediaElement视频播放
另一个需要注意的问题是,MediaElement默认是在主线程中运行,这可能会影响UI的响应速度。为了保证良好的用户体验,可以考虑在后台线程中加载和播放媒体文件,但这样就需要处理线程同步问题。
C# 使用WPF 用MediaElement控件实现视频循环播放
在这个特定的问题中,我们将探讨如何利用MediaElement来实现一个视频的循环播放,并提供对播放、暂停和停止功能的控制。首先,让我们深入理解MediaElement控件的一些基本属性和事件:1.
使用WPF MediaElement来播放MP4视频
WPF提供了丰富的样式和模板定制功能,可以通过`ControlTemplate`来改变MediaElement的呈现方式。
WPF 播放器 MediaElement
编程模型**MediaElement的编程模型分为两个阶段:加载(LoadState)和播放(PlayState)。
mediaElement示例
这个示例提供了清晰的演示,帮助开发者理解如何有效地集成和控制媒体元素在网页上。以下是对MediaElement核心功能和使用方法的详细说明。1.


