General ActiveX Control Usage Info

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
Crache

General ActiveX Control Usage Info

Postby Crache » 17 Jan 2006 14:03

After looking around on the forum to see if others were doing interesting things with the VLC ActiveX control, I mostly found a bunch of unanswered questions.

Without too much trouble I managed to use the ActiveX control in Visual Studio.NET 2003 with C#. A lot of people were lost in trying to figure out what the methods/functions were to do even the simplest of things, since there didn't seem to be much obvious documentation, aside from that in the autogenerated code docs.

I know someone had posted a full list of the functions they knew of in order to help others put together a more sensible reference on the ActiveX control. However, it's important to note that you can get a list of public properties, methods and events available from any ActiveX control's embedded DLLs. This is good for any new undocumented features that the VLC ActiveX control may eventually contain, and also good for figuring out how to use any other ActiveX control you may run into (though not a 100% substitute for actual documentation)

One app I know that lets you inspect ActiveX controls is ActiveXXX HardCore, which you can download from Moon Valley Software's site at: http://www.activex.moonvalley.com/samples/activex.zip

As a note, make sure you have the ActiveX control registered, otherwise it won't show up in the list, and there isn't an option to inspect an ActiveX control by browsing for it. You would need it registered anyway before it would show up in Visual Studio if you were planning to drop it into your app.

Luckily you don't have to rely solely on that as there's some VLC ActiveX control documentation on the wiki, http://wiki.videolan.org/index.php/ActiveX

It's important to note that the majority of the public control functions and properties are intended for basic video playing and playlist handling. In order to make use of VLC's more complex and extended features, you can set VLC command line options for each video in the playlist as well as setting variables during play that effect how it's played. You manage this by passing the options as the second parameter of addTarget(), or setting variables with setVariable("variable",value)

Also, with ActiveX controls, don't forget that you can attach eventhandlers for events in order to run your own code. VLC only has 3 events: play, pause and stop, but they're important to know because VLC still responds to features like double-click video to fullscreen and spacebar to play/pause, etc. If you are running statements that work under the assumption the video is playing and you aren't handling the events, then if one of it's built-in key/mouse events occur and the play state changes without you knowing it, your statement could run into a wall and OOPS, program crashes.



Parameter Options List (useful for options that must be set before a video loads)
-- http://wiki.videolan.org/index.php/VLC_ ... -line_help

Some Current State Variables (Search for var_Create)
-- http://trac.videolan.org/vlc/file/trunk/src/libvlc.c

Config/Option Variables (Search for add_int, add_bool, add_string, etc.)
-- http://trac.videolan.org/vlc/file/trunk/src/libvlc.h



Overall, you can make pretty good use of VLC's features without running into too many issues. Hope some of this info is useful.

-Crache

Quovodis
Cone that earned his stripes
Cone that earned his stripes
Posts: 271
Joined: 16 Jun 2004 11:13
Location: Cork, Ireland

Postby Quovodis » 17 Jan 2006 17:08

As the author of the ActiveX plugin, I am quite amazed how popular it has become.

The amount of questions relating to its usage has shown how important it has become for VLC project. And, I must take some blame for providing so little documentation for the casual user since I initially assumed that most people would read the code to figure out how things worked.

In order to make amends, I have updated the ActiveX README.TXT to contain more user level documentation;

You can obtain it at the following URL http://trac.videolan.org/vlc/file/trunk ... README.TXT

(I've added an excerpt at the end of this post which should be of interest for most users)

Unfortunately, I am not actually a power user of the ActiveX plugin, I developed it mostly as a pet project in order to leverage and improve my knowledge of ActiveX and windows in general.

However, If you are a power user and want to share your knowledge with the community, I would like to invite you to update the following wiki:

http://wiki.videolan.org/index.php/ActiveX

(thanks to 'lotsofpcs' for starting it)

excerpt of the README.TXT:

Code: Select all

V. Controlling the plugin 1) Properties the following public properties can be used to control the plugin from HTML, the property panel of Visual Basic and most ActiveX aware applications +==========+=========+================================+===============+ | Name: | Type: | Description: | Alias: | +==========+=========+================================+===============+ | autoplay | boolean | play when control is activated | autostart | +----------+---------+--------------------------------+---------------+ | autoloop | boolean | loop the playlist | loop | +----------+---------+--------------------------------+---------------+ | mrl | string | initial MRL in playlist | src, filename | +----------+---------+--------------------------------+---------------+ | mute | boolean | mute audio volume | | +----------+---------+--------------------------------+---------------+ | visible | boolean | show/hide control viewport | showdisplay | +----------+---------+--------------------------------+---------------+ | volume | integer | set/get audio volume | | +----------+---------+--------------------------------+---------------+ the alias column allows to specify an alternative <PARAM name> for the property in internet explorer, which is useful to maintain compatibility with HTML pages already leveraging Windows Media Player 2) Programming APIs the MRL, Autoplay and Autoloop properties are only used to configure the initial state of the ActiveX control,i.e before its activation; they are ignored afterward. Therefore, if some runtime control is required, the following APIs should be used within your programming environment: Variables: +==========+=========+=========+=======================================+ | Name: | Type: | Access: | Description: | +==========+=========+=========+=======================================+ | Playing | boolean | RO | Returns whether some MRL is playing | +----------+---------+---------+---------------------------------------+ | Time | integer | RW | Time elapsed in seconds playing | | | | | current MRL | | | | | NOTE: live feeds returns 0 | +----------+---------+---------+---------------------------------------+ | Position | real | RW | Playback position within current MRL | | | | | in a scale from 0.0 to 1.0 | | | | | NOTE: live feeds returns 0.0 | +----------+---------+---------+---------------------------------------+ | Length | integer | RO | Total length in seconds of current MRL| | | | | NOTE: live feeds returns 0 | +----------+---------+---------+---------------------------------------+ | Volume | integer | RW | Current volume from 0 to 100 | +----------+---------+---------+---------------------------------------+ | Visible | boolean | RW | Indicates whether control is visible | +----------+---------+---------+---------------------------------------+ Methods: play() Play current item the playlist pause() Pause current item in the playlist stop() Stop playing current item in playlist shuttle(Seconds as integer) Advance/backtrack playback by specified amount (which is negative for backtracking). This is also called relative seeking. This method does not work for live streams. fullscreen() Switch between normal and full screen video playFaster() Increase play back speed by 2X, 4X, 8X playSlower() Decrease play back speed by 2X, 4X, 8X toggleMute() mute/unmute sound output addTarget(MRL As String, Options as array of strings, Mode as enumeration, Position as integer) Add MRL into the default playlist, you can also specify a list of playlist Options to attach to this MRL or Null for no options. mode indicates the action taken by the playlist on MRL which is one the following: VLCPlayListInsert = 1 (Insert MRL into playlist at Position) VLCPlayListInsertAndGo = 9 (Insert MRL into playlist at Position and play it immediately) VLCPlayListReplace = 2 (Replace MRL in playlist at Position) VLCPlayListReplaceAndGo = 10 (Replace MRL in playlist at Position and play it immediately) VLCPlayListAppend = 4 (Append MRL in playlist after Position) VLCPlayListAppendAndGo = 12 (Append MRL in playlist after Position and play it immediately) VLCPlayListCheckInsert = 16 (Verify if MRL is in playlist) Position can take the value of -666 as wildcard for the last element in playlist setVariable(Name as string, Value as object); Set a value into a VLC variables getVariable( Name as string) as object Retrieve the value of a VLC variable.

MRTrevorF
Blank Cone
Blank Cone
Posts: 12
Joined: 03 Nov 2005 14:02

Postby MRTrevorF » 17 Jan 2006 18:01

Thanks for the info. I had also compiled a document based on the object library about events, methods and properties on VLC.

One question I had about working with the ActiveX component is the "Play" event. I see it as an available event, along with "Pause" and "Play", but when I put code into such an event, it never fires.

The methods work, but I can't get any functionality out of the events...

Crache

Postby Crache » 18 Jan 2006 05:05

Hey Quovodis, thanks for chiming in. It is indeed good to know there's an official readme.txt. I realize I started this thread on more of a C# basis, but for those of you out there interested more in embedding the VLC ActiveX control into your webpage, you can reference the HTML example.

VLC ActiveX Control HTML and Javascript Example
http://trac.videolan.org/vlc/file/trunk ... /test.html



Trevor, I hadn't specifically tried out the VLC ActiveX control's events, but I just went back and tested them to see if I could get them to work. I put code in all 3 and none of them worked. In the control the events are named play, pause and stop, and in Visual Studio they're watched like so:

this.axVLCPlugin1.playEvent += new System.EventHandler(this.axVLCPlugin1_Fullscreen);
this.axVLCPlugin1.pauseEvent += new System.EventHandler(this.axVLCPlugin1_Fullscreen);
this.axVLCPlugin1.stopEvent += new System.EventHandler(this.axVLCPlugin1_Fullscreen);

axVLCPlugin1_Fullscreen just being a basic function to run axVLCPlugin1.fullscreen(); for testing purposes. None of the events were triggered, regardless of using keyboard shortcuts or calling axVLCPlugin1.play/pause/stop().

I haven't tested using the events from within the browser embedded control, but it does appear that perhaps the VLC control events don't work. Maybe that's something for Quovodis to look into when he gets the time? I know that it's not the first time an ActiveX control's events weren't being triggered when running under .NET. Whether it's a .NET specific issue or not, I have no clue, but I wouldn't be surprised if it was completely unrelated.

For now, you can look at the HTML example linked above and you will see it doesn't use events, but went about it another way by using a timer to watch the .playing variable.

-Crache

tonsofpcs
Cone that earned his stripes
Cone that earned his stripes
Posts: 363
Joined: 04 Jan 2006 10:03
Location: Binghamton, NY, USA
Contact:

Postby tonsofpcs » 18 Jan 2006 09:07

Just letting you guys know that I updated the Wiki based upon the new readme. Thanks Quovodis.

(Again, the URL is: http://wiki.videolan.org/index.php/ActiveX )

Zmenice
New Cone
New Cone
Posts: 4
Joined: 04 Sep 2006 16:14

Exposing more Procedures from the axtiveX component...

Postby Zmenice » 04 Sep 2006 17:11

Hi all, I was just wondering if it was possible in .NET to expose more of VLC base functions using the activeX plugin.

More specifically I have the ActiveX plugin in a .NET Form and would like access to the image buffer that VLC uses to display an image on the screen.
IE capture a single RGB format image for image processing applications.

When I look at the component in the object browser I can see tons of functions that look promising but can't call them or see any details.

I'm hoping someone has a simple solution for me that doesn't involve compiling my own version of VLC and using that versions plugin

any help would be appreciated
Thanx

stacy3477
New Cone
New Cone
Posts: 3
Joined: 12 Dec 2006 19:08

Release 8.6?

Postby stacy3477 » 12 Dec 2006 19:13

Hi,

Does anyone know if the documentation (wiki and/or readme) has been updated to be current with the 8.6 release?

Thanks,
Stacy


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 7 guests