WPF VlC Implementation video playback (1)

Source: Internet
Author: User
Tags dotnet

WPF uses VLC to achieve video playback: Open source code i copied one copy: Https://github.com/someonehan/Vlc.DotNet

1. Preparation phase

(I) Libvlc.dll and Libvlccore.dll are required two libraries

(II) Use and also have the plugins folder under the messy DLL, this thing if not easy to find can install a VLC player on the computer and then in the installation directory will be able to locate this folder

2. Use playback

(i) the need to specify vlclibdirectory before using this open source control is basically the plugins folder under the messy DLL (there must be a lot of things are useless) specify this vlclibdirectory I use both methods:

            var currentassembly = assembly.getentryassembly ();             var New FileInfo (currentassembly.location). directoryname;             New @" .. \.. \.. \lib\x64\"));
View Code
vlcControl.MediaPlayer.VlcLibDirectoryNeeded + =onvlccontrolneedslibdirectory; Private voidOnvlccontrolneedslibdirectory (Objectsender, Forms.vlclibdirectoryneededeventargs e) {            varcurrentassembly =assembly.getentryassembly (); varCurrentDirectory =NewFileInfo (currentassembly.location).            DirectoryName; if(CurrentDirectory = =NULL)                return; if(Assemblyname.getassemblyname (currentassembly.location). ProcessorArchitecture = =processorarchitecture.x86) E.vlclibdirectory=NewDirectoryInfo (Path.Combine (CurrentDirectory,@".. \.. \.. \lib\x86\")); Elsee.vlclibdirectory=NewDirectoryInfo (Path.Combine (CurrentDirectory,@".. \.. \.. \lib\x64\")); }
View Code

There is no doubt that the second method is much better, the first way I run it on my computer.

(II) What is Vlccontrol, this is a defined control in open source code that we need to define on the xmlns interface

xmlns:wpf= "CLR-NAMESPACE:VLC.DOTNET.WPF;ASSEMBLY=VLC.DOTNET.WPF" < -- This quote has to be added-- > <  x:name= "Vlccontrol"></wpf:vlccontrol>
View Code

(III) The rest is to play the video, we can call similar code at the appropriate time, of course, to give VLC powerful features we can not only play any format of the local video (wipe, now the various formats of the video format is really painful) can also play network video

VlcControl.MediaPlayer.Play (New FileInfo (@ "C:\Users\Public\Videos\Sample videos\wildlife.wmv"));// Play a video of the wild animals we have on our computers.
View Code

Here's a news video I've been looking for online.

VlcControl.MediaPlayer.Play (NewUri ("Http://218.93.204.74/145/49/102/letv-uts/14/ver_00_22-322571901- avc-479655-aac-32005-220400-14345429-51c2a04560d147a24c1357f68cd84849-1436438909790_mp4/ver_00_22_3_3_1_820432 _700112.ts?crypt=30aa7f2e236&b=520&nlh=3072&nlt=45&bf=36&p2p=1&video_type=mp4& termid=1&tss=ios&geo=cn-1-12-1&platid=1&splatid=101&its=0&proxy= 3736741834,987235498,1032384108&keyitem=platid,splatid,its&ntm=1436767800&nkey= d0d58ef311bc08d22da3b6d753a97c31&nkey2=1a2c44f168e70910f6586dcd1dba9217&mltag=1&mmsid=32925199 &tm=1436756751&key=ed30d40ea485ed2ea14d0a2b17f71c6b&playid=0&vtype=13&cvid=474368485029 &payff=0&ctv=pc&m3v=1&hwtype=un&ostype=windowsserver2008r2&tag=letv&sign=zw_ Baidushort&p1=1&p2=10&p3=-&tn=0.11052118893712759&pay=0&uuid= e98b6e3090fb295cf7c5e1030baf7f351c1f96a6&token=null&uid=null&rateid=1000&errc=0&gn=1058 &buss=100&qos=4&cips=113.208.137.58&ch=&p1=1&p2=10&p3=-&appid=500&v=vod.4.2.07022222&rd=1436756767540 "));
View Code

Simple playback first implemented in this, if you want to play the video in shared memory How should I do? For the time being, I don't know if I can take a look!

WPF VlC Implementation video playback (1)

Related Article

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.