WPF development VLC Player (universal player)

Source: Internet
Author: User
Tags dotnet

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.