So for the last couple of days, I’ve been working on a Media Player project written in C# and WPF using Vlc.DotNet, a .NET control and wrapper for the VLC libraries.
Unfortunately, the documentation is rather sparse, so I’ve been trying to piece a few things together. If I get far enough into understanding it, I may consider contributing to the documentation.
My first issue was with getting the XAML control and the code-behind to work properly. I ended up realizing that the control is looking for the VLC libraries, so I had to define where they were located:
VlcControl.MediaPlayer.VlcLibDirectory = new DirectoryInfo(LIBVLC_PATH_DEFAULT_AMD64);
(Note: LIBVLC_PATH_DEFAULT_AMD64 is a private const string that is initialized outside of MainWindow() which holds the string value. In the future, I will expand this to determine whether to use x86 or x64 libs. For now, it’s using an explicitly defined path)
This passes a DirectoryInfo instance to the VlcLibDirectory property so that it can initialize in the next line:
VlcControl.MediaPlayer.EndInit();
Both of these are inside of a try-catch block, as they can throw a variety of exceptions, notably ArgumentException, DirectoryNotFoundException, and FileNotFoundException. At the moment, if one is detected, a MessageBox appears to notify us of the error, then the program gracefully closes.
I’m still exploring the code for the Vlc.DotNet project. I’ll have more to write in a follow up post.