ActiveX
The Windows build of VLC includes an (optionaly installed) ActiveX control. The ActiveX control enables VLC to be embedded in web browsers and third-party applications.
Properties
The ActiveX control includes the following properties:
| name | type | get or set | description |
| Length | Integer | get | Returns length of the current clip. |
| playlistCount | get | Returns the count of items in the playlist | |
| playlistIndex | get | Returns the index of the current item in the playlist. | |
| AutoLoop | Boolean | get/set | Determines if the player should automatically loop when it finishes the current playlist. |
| AutoPlay | Boolean | get/set | Determines if the player should start playing a new file/playlist immediately upon being loaded. |
| Volume | Integer | get/set | Current volume (scaled from 0 to 100) |
| MRL | String | get/set | Presumably returns the MRL of the currently loaded file. |
| Time | Integer | get/set | Time elapsed in seconds playing current MRL, 0 for live feed |
| showdisplay | Boolean | get/set | show/hide control viewport |
| Playing | Boolean | get | Returns whether some MRL is playing |
| Position | 'real' | get/set | Playback position within current MRL, scaled from 0.0 to 1.0. Live feed returns 0.0 |
| VersionInfo | String | get | Returns version and build information. |
Note: In Visual Basic, type "Long" should be used for properties listed with type "Integer".
Methods
The ActiveX control includes the following methods (functions):
| name | type | description | syntax (VB) |
| setVariable | method | Assigns a value to a variable that is defined in libvlc.c | controlname.setVariable name as String, value |
| getVariable | method | Returns the contents of a variable that is defined in libvlc.c | x = controlname.getVariable(name as String) |
| pause | method | Pauses the currently playing clip | controlname.pause |
| play | method | Plays as in the normal player, if a clip is not loaded, does nothing. | controlname.play |
| playFaster | method | Makes the currently playing clip play faster. | controlname.playFaster |
| playSlower | method | Makes the currently playing clip play slower. | controlname.playSlower |
| stop | method | Makes the currently playing clip stop. | controlname.stop |
| shuttle | method | Moves the playback position a specified number of seconds in either direction. | controlname.shuttle(seconds as Long) |
| playlistClear | method | Clears the playlist | controlname.playlistClear |
| playlistNext | method | Goes to next item in the playlist | controlname.playlistNext |
| playlistPrev | method | Goes to previous item in the playlist | controlname.playlistPrev |
| addTarget | method | Adds a uri to the current playlist or replaces the current playlist with the uri. | controlname.addTarget(uri as String, options, mode as VLCPlaylistMode, Position as Long) |
| toggleMute | method | Toggles between the muted/unmuted state of the embedded player. | controlname.toggleMute |
| fullscreen | method | Toggles between fullscreen and non-fullscreen modes. | controlname.fullscreen |
Options
The addTarget method accepts most of the command line options; including, but not limited to, the following :
:audio-track=index:vout-filter=output-filter(deinterlacefor example):deinterlace-mode=mode(linearfor example)
Samples
Installing
Introduction
VideoLAN is not a good source for the installation of VLC through an ActiveX control. At some point, Microsoft Internet Explorer stopped allowing the installation of ActiveX controls unless:
- they were signed to associate the software vendor's name with the file containing the ActiveX control, or
- they resided in an "trusted site"
The second option is only feasible where both server and client infrastructure are managed under the same umbrella. The first option requires a Certificate Authority to sign the control. This comes at a cost which the VideoLAN project is not able to bear. The solution is to create one's own ActiveX control distribution, which in turn can be digitally signed by a Certificate Authority of your choice, if necessary.
Creating an VLC ActiveX Distribution
The following requisites are required:
- CABSDK by Microsoft to create a Cabinet File (.cab-file) containing the relevant VLC files. MSDN has a good description how to package an ActiveX Control including a link to the CABSDK download page here
- The .cab-file contents, consisting of:
- axvlc.inf - The INF file, which would be called manifest in the modern age
- axvlc.dll - ActiveX DLL which bootstraps the VLC setup file
- vlc-0.8.6c-win32.exe - VLC setup file (refer to your version)
I am using the following code in the INF file:
; Version number and signature of INF file.
;
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
vlc-0.8.6c-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.6c-win32.exe]
FileVersion=0,8,6,0
file-win32-x86=thiscab
[nsiinstaller]
run=%EXTRACT_DIR%\vlc-0.8.6c-win32.exe
Again, refer to your version of VLC.
You can extract axvlc.dll from the binary distribution of VLC. This is a zip file on VideoLAN's download page, version 0.8.6.c here.
The setup file is the "featured" download on VideoLAN's main pagel; a copy resides in the same directory as axvlc.dll, version 0.8.6.c http://downloads.videolan.org/pub/videolan/vlc/0.8.6c/win32/vlc-0.8.6c-win32.exe here].
With these three components in place, you can create the .cab-file using the CABARC tool from Microsoft's CABSDK, using the following command from a command prompt:
CABARC.EXE N axvlc.cab axvlc.inf axvlc.dll vlc-0.8.6c-win32.exe
This assumes the PATH has been set to CABARC.EXE's directory. If you need to sign the .cab-file, you need to use the -s switch to allocate space for your digital certificate.