WPF中应用VLC播放器

WPF中应用VLC播放器

文章目录

    • WPF中应用VLC播放器
      • 1. 安装VLC.DOtNet.Wpf包
      • 2.程序中使用
      • 3.源代码
      • 4.VLC GitHub源代码

1. 安装VLC.DOtNet.Wpf包

WPF中应用VLC播放器_第1张图片

2.程序中使用

Xaml:添加Vlc的引用:

xmlns:vlc="clr-namespace:Vlc.DotNet.Wpf;assembly=Vlc.DotNet.Wpf"
   

cs:

  public MainWindow()
  {
            InitializeComponent();
            //VLC播放器的安装位置,我的VLC播放器安装在D:\Program Files (x86)\VideoLAN\VLC文件夹下。
            string currentDirectory = @"D:\Program Files (x86)\VideoLAN\VLC";
            var vlcLibDirectory = new DirectoryInfo(currentDirectory);

            var options = new string[]
            {
                //添加日志
                "--file-logging", "-vvv", "--logfile=Logs.log"
                // VLC options can be given here. Please refer to the VLC command line documentation.
            };
            //初始化播放器
            this.vlcPlayer.SourceProvider.CreatePlayer(vlcLibDirectory, options);

            // Load libvlc libraries and initializes stuff. It is important that the options (if you want to pass any) and lib directory are given before calling this method.
            //设置播放源
            this.vlcPlayer.SourceProvider.MediaPlayer.Play(new Uri(@"H:\DZBStudyRecord\2019-5-9VLCTest\VLCTest\FFMETest\wuyawang.mp4"));//本地文件。
            this.vlcPlayer.SourceProvider.MediaPlayer.Play(new Uri("rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov");//Rtsp流文件。
 }
            this.vlcPlayer.SourceProvider.MediaPlayer.Play(new Uri("rtmp://10.160.64.244:1935/live/room"));

3.源代码

VLC

4.VLC GitHub源代码

vlc源代码

你可能感兴趣的:(WPF,c#)