Application of VLC II: VLC's ActiveX and cab

Source: Internet
Author: User

Please go to https://higoge.github.io/, all the download materials can be found on that blog. Thank you.

http://jeremiah.blog.51cto.com/

2009-05-14 Additions: 8. ActiveX uninstall; 9. Let VLC install ActiveX automatically; 10. Description of the ActiveX for VLC.

VLC has its own ActiveX control--axvlc.dll, under the ActiveX folder after compiling VLC. ActiveX is a good thing, axvlc.dll can be arbitrarily placed in any location, after successful registration can be easily applied in the program and Web pages. You can refer to test.html and README.TXT under the ActiveX folder. The interface of the ActiveX control has the first and second editions, the first version is simple, the function is few, it is no longer recommended to use the second version, more features. (Refer to [1])
The ActiveX registration method for vlc-0.8.6i and vlc-0.9.4 is slightly different.
Before you do the Web test for ActiveX, you need to minimize the security level of the Internet option--security--Local intranet. Jeremiah's Web test environment is IE7, and other browsers are not tested.

1. vlc-0.8.6i's ActiveX Registration
Under e: Create a new folder Vlc-0.8.6iactivex, copy the Plugins,libvlc.dll,activex/axvlc.dll to the Vlc-0.8.6iactivex/dlls directory under the vlc-0.8.6i directory, Copy the activex/test.html to the Vlc-0.8.6iactivex. New text file Install.bat content is as follows:

regsvr32 dlls\axvlc.dll

Double-clicking Install.bat will prompt "DllRegisterServer success in Dlls\axvlc.dll". Then with the open test.html, the text box input MRL will be able to play.

2. vlc-0.9.4 's ActiveX Registration
0.9.4 not only to tell the computer VLC Axvlc.dll location, but also to tell the registry installdir location, that is, the location of Libvlc.dll
Under e: Create a new folder Vlc-0.9.4activex, copy the Plugins,libvlc.dll,libvlccore.dll,activex/axvlc.dll to vlc-0.9.4activex/under the vlc-0.9.4 directory Under the DLLs directory, copy activex/test.html to Vlc-0.9.4activex. New text file Install.reg content is as follows:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\VIDEOLAN\VLC]
"InstallDir" = "E:\\vlc-0.9.4activex\\dlls"

New text file Install.bat content is as follows:

regsvr32 dlls\axvlc.dll

REGEDIT/S Install.reg

    Double-click Install.bat to test with test.html.

    3. A little bit of hint
    if the registration is successful, but test.html when the file is played, the error is said decoder Modules will not be able to find such information, please register 0.8.6i and 0.9.4 Alternately, this problem may be resolved. (Jeremiah because of this problem for a day, NND) (2009-05-14 added: direct look at 8 bar, this place was not very well written in the past.)
    
    4. Making a CAB file
    If you want to make a player server similar to test.html, but we can not manually manipulate the client to download the registration of VLC ActiveX, the solution is to make a CAB file.
    (1) to the annex to this log (Cabsdk.rar) or the following address to download cabsdk.exe:[url]http://download.microsoft.com/download/ Platformsdk/cab/2.0/w98nt42kmexp/en-us/cabsdk.exe[/url]
    (2) Install Cabsdk.exe
     (3) Copy the installation files of Axvlc.dll and VLC to the CABSDK installation path/bin/. Jeremiah here is Vlc-0.8.6i-win32.exe. (about how to make VLC installation files, refer to the log "VLC compilation II under Windows platform: vlc-0.8.6i's compilation")
    (4) Create a new text file Axvlc.inf under/bin with the following:

; Version number and signature of INF file.
;
[Version]
Signature= "$CHICAGO $"
advancedinf=2.0

[Add.Code]
Vlc-0.8.6i-win32.exe
Axvlc.dll=axvlc.dll

[Axvlc.dll]
fileversion=0,8,6,0
clsid={9be31822-fdad-461b-ad51-be1d1c159921}
Registerserver=no
Hook=nsiinstaller

[Vlc-0.8.6d-win32.exe]
fileversion=0,8,6,0
File-win32-x86=thiscab

[Nsiinstaller]
Run=%extract_dir%\vlc-0.8.6i-win32.exe

Note: Modify this file according to the version of your installation file.
(5) from the command line to the bin directory, execute the following command to generate the CAB file:

Cabarc. EXE N axvlc.cab axvlc.inf axvlc.dll Vlc-0.8.6i-win32.exe


5. Use of CAB files
The use of CAB files under HTML pages can be done in the following ways:

<object classid= "clsid:9be31822-fdad-461b-ad51-be1d1c159921"
                 codebase= "Your/path/of/cabfile/axvlc.cab"
                          width= "640" height= "480" id= "VLC" events= "True";
<param name= " SRC " value=" "&NBSP;/>
<param name=" Showdisplay " value=" True "&NBSP;/>
<param  name= "Autoloop"  value= "false" &NBSP;/>
<param name= "AutoPlay"  value= "false"   />
</object>

This allows the Web client to use it without having to manually register Axvlc.dll.

6. A little more serious problem
Because VLC installation file is generally relatively large, so the CAB file is also very large, in the network bandwidth is not very good, the light download this cab may be a long time, basically can say this way is not feasible. So we need to streamline VLC according to our business needs. Jeremiah will be introduced in the next log.

7. ActiveX using VLC under C #
VS2005 Create a new Windows application, right-click on the left-hand toolbox and select the-->com component-->videolan VLC ActiveX plugin v2, which adds VLC ActiveX controls to the Toolbox. You can draw it in the form.
The calling function is as follows:

private void Button1_Click (object sender, EventArgs e)
{
Input parameters
String parameter = ": sout= #duplicate {dst=display}: No-overlay";

Determine if you are playing
if (this.axVLCPlugin21.playlist.isPlaying)
{
If it is playing, stop
This.axVLCPlugin21.playlist.stop ();
}

Empty playlist
This.axVLCPlugin21.playlist.clear ();

Add Playlist
This.axVLCPlugin21.playlist.add (TextBox1.Text, NULL, parameter);

Playlist updates to newly added play items
This.axVLCPlugin21.playlist.next ();


Play
This.axVLCPlugin21.playlist.play ();
}

Other function calls refer to Activex/readme. Txt.
Jeremiah provides a simple calling program (Windowsapplication1.rar) in the attachment, but it is important to note that in using it to test the ActiveX of 0.9.4, when the file is played properly, clicking the X Close window produces an exception and the computer restarts. In the main form of the

FormClosing event in the main thread to sleep 1000ms, and can not fully guarantee that the computer does not restart, so please according to their own situation of this attachment debugging.

8. Uninstallation of ActiveX

Uninstall is the reverse operation of the installation, know how to install, uninstall is very simple.

vlc-0.8.6i ActiveX Uninstall: Create a new uninstall.bat with the following content:

regsvr32 dlls\axvlc.dll/u

vlc-0.9.4 ActiveX Uninstall: Create a new Uninstall.reg with the following content:

Windows Registry Editor Version 5.00

[-hkey_local_machine\software\videolan]

Create a new uninstall.bat with the following content:

regsvr32 dlls\axvlc.dll/u

REGEDIT/S Uninstall.reg

Double-click Uninstall.bat to prompt for DllUnregisterServer success in Dlls\axvlc.dll. The uninstallation is complete.

9. Install the ActiveX automatically when VLC is installed

4 refers to the production of cab packages and 5 mentions the use of cab packages. The cab is actually for the customer to automatically download VLC installation files and then start the installation. However, during the installation process, a step like this occurs:

Activex plugin default is not selected, how to make it this step is selected by default, or is selected and gray (such as the media Player this one), do not let customers change it? We need to modify the compiled Vlc.win32.nsi file for VLC. Then use it to re-create the Vlc-0.9.4-win32.exe.

The specific modification process is as follows:

In the Vlc.win32.nsi file, locate the following:

section/o $Name _section04 SEC04
Sectionin 3

Modified to:

Section $Name _section04 SEC04
Sectionin 1 2 3

Or, after 1 2 3, add "space ro", indicating that this is a must not be removed, is selected and is gray. $Name _section04 can be replaced with my own name as "my ActiveX plugin (required)".

Then according to the previous blog on the production of the Vlc-0.9.4-win32.exe process to execute, and then make a cab package is okay.

10. Description of the ActiveX for VLC

According to my use of VLC, I found this ActiveX is really bad, many methods are not encapsulated in, if the extension of this ActiveX, the workload is not small. If it is a C/s program, it is strongly not recommended to use ActiveX to develop. Unless you want to do simple, rapid development and so on. Do c/s player or read me this blog: "Application of VLC three: dynamic call vlc-0.9.4 Libvlc.dll", the development process, although slow, but more controllable. ActiveX only suitable for B/s project, only suitable for web development, this is a bit of advice Jeremiah, but only for personal opinion, for reference only.

Application of VLC II: VLC's ActiveX and cab

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.