Search code examples
c#winformslibvlcvlc.dotnet

VLC controller is not rendering video


I ma trying to stream a video from this a rtsp url. When I run the application, I do not get any error but the video is not rendering. I can view this stream on other application but not on this one. Please see my code below:

private void Form1_Load(object sender, EventArgs e)
{
    vlcControl1 = new VlcControl();
    vlcControl1.BeginInit();
    vlcControl1.VlcLibDirectory = new DirectoryInfo(@"C:\Program Files (x86)\VideoLAN\VLC");
    vlcControl1.VlcMediaplayerOptions = new[] { "-vv" };
    vlcControl1.EndInit();
    //Controls.Add(this.vlcControl1);

    string[] options = { ":network-caching=30" };

    vlcControl1.Play(new Uri("rtsp://Username:[email protected]:xxx/cam/realmonitor?channel=1&subtype=1&unicast=true&proto=Onvif"), options);
}

Solution

  • Since it looks like you're using Vlc.Dotnet, I'd strongly advise you get a hold of a simple sample like this one and go from there.

    Also, it's bad practice to develop an application using your installed VLC librairies. Updating your local VLC application will update libvlc for all your apps developed relying on it (one of many reasons why it's a bad idea).

    Use this https://www.nuget.org/packages/VideoLAN.LibVLC.Windows/ instead of the dlls in Program Files.