首先通过 Nuget 下载 VLC 相关的组件;
View 层(XAML)
添加引用
xmlns:Vlc="clr-namespace:Vlc.DotNet.Wpf;assembly=Vlc.DotNet.Wpf"
添加控件
<Vlc:VlcControl xmlns:Vlc="clr-namespace:Vlc.DotNet.Wpf;assembly=Vlc.DotNet.Wpf" x:Name="MyControl" />
然后在窗体组件初始化之后,执行加载函数
-
var vlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, “libvlc”, IntPtr.Size == 4 ? “win-x86” : “win-x64”));
-
-
var options = new string[]
-
{
-
// VLC options can be given here. Please refer to the VLC command line documentation.
-
};this.MyControl.SourceProvider.CreatePlayer(vlcLibDirectory, options);this.MyControl.SourceProvider.MediaPlayer.Play(“http://xxx//xxx.mp4”);转自:https://www.freesion.com/article/4778548732/