我跟踪了这个
link
的指示添加
Vlc.DotNet
图书馆(
.Core
,则,
.Core.Interops
,则,
.Forms
和
.Wpf
)我的项目解决方案。
我还添加了
VideoLAN.LibVLC.Windows
图书馆
我在表单中添加了一个vlcControl,这就是结果
Designer.cs
:
//
// vlcControl1
//
this.vlcControl1.BackColor = System.Drawing.Color.Black;
this.vlcControl1.Location = new System.Drawing.Point(384, 357);
this.vlcControl1.Name = "vlcControl1";
this.vlcControl1.Size = new System.Drawing.Size(75, 23);
this.vlcControl1.Spu = -1;
this.vlcControl1.TabIndex = 6;
this.vlcControl1.Text = "vlcControl1";
this.vlcControl1.VlcLibDirectory = ((System.IO.DirectoryInfo)(resources.GetObject("vlcControl1.VlcLibDirectory")));
this.vlcControl1.VlcMediaplayerOptions = null;
我在属性中添加了一个虚拟VlcLibDirectory,以便以后更改它。
我的vlcLib x86版本的路径是:
E:\testLouka\dansMaCamera2.0\dansMaCamera2.0\libvlc\win-x86
我尝试使用以下代码从RTSP流url获取视频提要:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.vlcControl1 = new VlcControl()
{
Name = "vlc1",
Location = new Point(0, 0),
Dock = DockStyle.Fill,
VlcLibDirectory = new DirectoryInfo(Path.Combine("E:\\testLouka\\dansMaCamera2.0\\dansMaCamera2.0", "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64")),
Spu = -1,
VlcMediaplayerOptions = null,
Enabled = true
};
string[] options = { ":network-caching=500" };
vlcControl1.Play(new Uri(m_stream.URL), options);
}
}
这个
m_stream.URL
变量正在返回RTSP链接,如下所示“
rtsp://admin:admin123@190.19.191.19/Stream0
“”
我的表单出现了,但我的vlcController没有显示任何内容。。。
我看着
https://github.com/ZeBobo5/Vlc.DotNet
的wiki,但我被卡住了。。。
我做错了什么?