Recently I’ve been working on the issue of using VLC streaming media in WPF. Now VLC can be played locally in WPF.Streaming playback solved, in the following code annotation streaming media playback those two pieces of code, more care about people to explore the ^^,For everyone to learn from each other, here I will first implement the VLC local broadcast code and process to write a friend for reference.
First, go to the following website:
VideoLan DotNet for WinForm, WPF, SL5 – 2011.11.29.zip
After decompression, there are five.Dll inside.
Add different references depending on what program you write, such as the program you use WPF to doVlc.DotNet.Wpf.dll、Vlc.DotNet.Core.dll、Vlc.DotNet.Core.Interops.dllAdd to project and reference.
2. Download the latest VLC player on the VLC website, then install it, and copy the files VideoLAN VLC and VideoLAN VLC plugins into the project in the installation file directory.
After completing the above tasksAdd reference to namespace in XAML:
The background code in the project is as follows:
private void Window_Loaded(object sender, RoutedEventArgs e)
var appPath = AppDomain.CurrentDomain.BaseDirectory;
VlcContext.LibVlcDllsPath = appPath + @”VLC\”;
//Set the vlc plugins directory path
VlcContext.LibVlcPluginsPath = appPath + @”plugins\”;
//Set the startup options
VlcContext.StartupOptions.IgnoreConfig = true;
VlcContext.StartupOptions.LogOptions.LogInFile = false;
VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = false;
VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.None;
//Initialize the VlcContext
VlcControl myVlcControl = new VlcControl();
// Create bindings, bind Image
Binding bing = new Binding();
bing.Source = myVlcControl;
bing.Path = new PropertyPath(“VideoSource”);
//Streaming media playback
var media=new LocationMedia(“udp://@:ip:port”);
myVlcControl.Play(new PathMedia(Add local video path)
If you have any questions or better suggestions, please give us more advice! Thanks!!!