VLC.DOTNET 3.0.8 在 WPF 中的播放

首先通过 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" />

然后在窗体组件初始化之后,执行加载函数

  1.  
    var vlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));
  2.  
     
  3.  
    var options = new string[]
  4.  
    {
  5.  
    // VLC options can be given here. Please refer to the VLC command line documentation.
  6.  
    };
    this.MyControl.SourceProvider.CreatePlayer(vlcLibDirectory, options);
    this.MyControl.SourceProvider.MediaPlayer.Play("http://xxx//xxx.mp4");
    转自:https://www.freesion.com/article/4778548732/
原文地址:https://www.cnblogs.com/javalinux/p/14547895.html