Custom VLC-based video player and vlc player

Source: Internet
Author: User

Custom VLC-based video player and vlc player

Preface (background story of egg pain)

Some time ago, after receiving a small project, we had to loop back and play the music video (similar to screen protection in Windows) after the system was waiting for a while ).

When I heard this requirement, I first thought of MediaPlayer and Flash, because these two components are installed on almost all Windows platform computers. However, the customer said that Flash was not available because it was previously used and unstable. Therefore, I decided to use MediaPlayer.

MediaPlayer can be easily loaded into the VS toolbox as a COM component. It is super easy to use and drag directly to the Form when used. In addition, there are many examples for searching on the Internet. So, the progress is very smooth...

A few days later, the problem came. The customer once got off work in the afternoon and forgot to shut down after the system was running. The next morning, only the system desktop was displayed, and he was not sure when he would "crash. So they tested the standby problem the next day, and then found that the crash problem frequently occurs during the standby .. My intuition at the time was: a bunch of SB, don't TM download the GHO image online to install a system with a bunch of viruses and plug-ins, don't install anti-virus software on TM to kill Lao Tzu's process (because some operation code in the program was killed as a virus by 360 during my testing, which I thought was also a problem with anti-virus software ).

With a feeling of great trust in Microsoft, I silently scolded SB and asked them to reload the system with the official ISO. Do not install anti-virus software or set my programs as trusted in anti-virus software. At the same time, I re-checked all methods in the system to ensure that all operations are handled abnormally, and added Application-level exception handling .. However, it is useless.

Helpless, go to the site for investigation .. They did not fool me. Just as I comfortably leaned on the chair to enjoy my favorite music video, the program was gone, and it was simply gone, without even an error message. With. NET so long, the trusted exception handling mechanism did not work .. The feeling is like the warmth of a quilt in the morning of winter. It is like the hollow hole that suddenly disappears when the girl is lingering with the girl...

Later, they carefully confirmed the frequency of the problem. They said the problem may last for three or four hours, or six or seven hours. Sometimes the error "***. exe has stopped running" is reported, and sometimes there is nothing. The direct program interface disappears, as if it has never been started .. They once switched to a computer for testing, and the problem is even worse. Sometimes they crash once in half an hour.

The program disappears directly, and the exception capture code is certainly not executed. In fact, logs are all suddenly interrupted without any logs of exceptions or logic shutdown. During an in-depth investigation, we found that this error was not recorded in system logs .. The system flashed back seven or eight times over the past two days, but there were only three logs about the application in the system, and there was no log record of the crash I saw just now .. The error code found in one of the error records is "component exception ".. Component, only MediaPlayer...

Baidu, Google, Bing, and 360 searches, however, are useless .. The introduction to MediaPlayer components on the internet is mostly an easy-to-use and convenient compliment. It is the kind of sense of accomplishment that can teach the white guys to write a simple playback form, and no deep clues are found ..

Helpless, decided to give up MediaPlayer.

Later, I found the VLC Player introduced in a blog (but I forgot which of my predecessors wrote the article ).

According to the introduction in the blog, I downloaded the component, wrote a simple Demo, and then added it to the system. It looks much better to run it. However, when a music video was played to a certain point in time, they reported an error and checked the information. Finally, they found the cause on an EN-wen website that it was a version problem and downloaded the latest VLC Player, you can use the latest database.

Then, download the VLC Player, install it, find the latest DLL and plug-in package in the installation directory, and overwrite the package to the project, so there is no problem of flashback.

You can also lazily lean on the back of the chair and drink the coffee that the beautiful girl of the customer company makes. By the way, you can enjoy the heart-shaped lahua on the coffee, and YY shows the girl's plump body...

 

Start of Text

VLC Player is a very powerful Player with a low profile and simple UI. It is not as cool and messy as other players do.

(To prevent the 32-bit and 64-bit systems from being used together, the 32-bit x86 library is used here)

2. Download a VLC player, install it, and find the required class library in the installation directory,

 

Step 2: map and encapsulate dll library functions.

Libvlc. dll and libvlccore. dll are not. NET class libraries, so they cannot be directly referenced in our project. Here I refer to examples of other predecessors to encapsulate them for ease of use.

Because the code is long, so here not directly posted, need friends can download http://files.cnblogs.com/files/zhhh/VlcPlayerBase.zip here

The Code encapsulates some common functions such as playback, pause, stop, volume control, and progress control for later use.

  
Step 3: Use

After encapsulation, you can call it directly to design a simple interface.

 

 

 
Last

DLL is actually the configuration and operation of the Player using VLC parameters, for the introduction of these parameters, you can refer to the Help File vlc-help.txt under the VLC Player installation directory,

 

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.