First, download the latest VLC player on VLC official website, then install and copy the files Videolan\vlc\ and videolan\vlc\plugins\ to the project in the installation file directory respectively.
The \VLC folder includes the \plugins folder, Axvlc.dll,Libvlc.dll, Libvlccore.dll, Npvlc.dll, and copies the entire VLC folder to \bin\x86\debug\;
Note: Under the x86 platform
Second, add a reference
1.vlc.dotnet.core.dll
2.vlc.dotnet.core.interops.dll
3.vlc.dotnet.forms.dll
4.vlc.dotnet.silverlight.dll
5.vlc.dotnet.wpf.dll
Add three black to WPF
Third, the front desk
To add a reference to the namespace in XAML:
Xmlns:local= "CLR-NAMESPACE:VLC.DOTNET.WPF;ASSEMBLY=VLC.DOTNET.WPF"
<Grid>
<image x:name= "img"/>
<Grid/>
Four, backstage
1 usingVlc.DotNet.Core;2 usingVlc.DotNet.Core.Medias;3 usingVLC.DOTNET.WPF;4 5 namespaceWpf_vlcplayer6 {7 /// <summary>8 ///the interactive logic of MainWindow.xaml9 /// </summary>Ten Public Partial classMainwindow:window One { A PublicMainWindow () - { - InitializeComponent (); the } - - - + - + Private voidWindow_Loaded (Objectsender, RoutedEventArgs e) A { at varAppPath =AppDomain.CurrentDomain.BaseDirectory; -Vlccontext.libvlcdllspath = AppPath +@"vlc\"; - //Set the VLC plugins directory path -Vlccontext.libvlcpluginspath = AppPath +@"vlc\plugins\"; - - //Set the startup options inVlcContext.StartupOptions.IgnoreConfig =true; -VlcContext.StartupOptions.LogOptions.LogInFile =false; toVlcContext.StartupOptions.LogOptions.ShowLoggerConsole =false; +VlcContext.StartupOptions.LogOptions.Verbosity =Vlclogverbosities.none; - the //Initialize the Vlccontext * vlccontext.initialize (); $ Panax NotoginsengVlccontrol Myvlccontrol =NewVlccontrol (); - //create bindings, bind image theBinding bing =NewBinding (); +Bing. Source =Myvlccontrol; ABing. Path =NewPropertyPath ("VideoSource"); the img. SetBinding (Image.sourceproperty, Bing); + - //Streaming media playback $ $ //var media = new Locationmedia ("UDP://@:ip:port "); - - //myvlccontrol.play (media); the - //Local PlaybackWuyi theMyvlccontrol.play (NewPathmedia (@"E:\BirdDetect\BDRecordVideo\test11.mp4"));//add local video path - Wu //Vlccontext.closeall (); - About $ } - - - A + } the}
WPF development VLC Player (universal player)