[vlc-devel] Support of events in Mozilla plugin - Beta

Yannick Bréhon y.brehon at qiplay.com
Tue Sep 1 15:52:49 CEST 2009


Hello everyone,

In an effort to support VLC events in the VLC Mozilla plugin, we have
developed at our company the attached patch.
It is still in early stages:
- it only works when compiled with a recent npfunctions.h, npapi.h,
npruntime.h, nptypes.h, npupp.h (on our Ubuntu system, we used the
latest API Mozilla furnishes with Firefox, which is located in a
Seamonkey folder)
- it only works on a browser supporting this recent plugin API
- it has only been tested on Ubuntu-32 bits, but no specific code has
been written (however, npunix.c has been modified, appropriate
modifications would be required on npwindows, npmac as well)
- a slight timeout is required after VLC plugin instanciation and before
calling addEventListener

This has been diffed against VLC 1.0.1 release code.

The way our code is called in javascript is the following:

vlc_plugin_id.addEventListener(callback, custom_parameter)

this will call the "callback" function with parameter "custom_parameter"
(which can be for instance a user-specified id) as soon as a "generic"
event is fired by VLC


vlc_plugin_id.addEventListener(callback, custom_parameter, eventProfile)

- if eventProfile is set to "all":
this will call the "callback" function with parameter "parameter" (which
can be for instance a user-specified id) as soon as any event is fired
by VLC
- if eventProfile is set to "minimalist":
this will call the "callback" function with parameter "parameter" (which
can be for instance a user-specified id) as soon as an event is fired by
VLC which is an event of the "minimalist" group of events
- if eventProfile is set to "generic", this is equivalent to not
specifying the eventProfile
- if eventProfile is set to a specific event type:
this will call the "callback" function with parameter "parameter" (which
can be for instance a user-specified id) as soon as an event of the type
"eventProfile" is fired by VLC


Here is the list of the VLC events. Those marked "g" are what we called
"generic", those marked "a" are in the "all" group and those marked "m"
are in the "minimalist" group. All events can be called specifically
using their event name (eg: vlc_plugin_id.addEventListener(callback, 0,
"libvlc_MediaPlayerOpening")

	       libvlc_MediaPlayerOpening                a g m
	       libvlc_MediaPlayerBuffering              a g
	       libvlc_MediaPlayerPlaying                a g m
	       libvlc_MediaPlayerPaused                 a g m
	       libvlc_MediaPlayerStopped                a g m
	       libvlc_MediaPlayerForward                a g
	       libvlc_MediaPlayerBackward               a g m
	       libvlc_MediaPlayerEndReached             a g
	       libvlc_MediaPlayerEncounteredError       a
	       libvlc_MediaPlayerTimeChanged            a
	       libvlc_MediaPlayerPositionChanged        a
	       libvlc_MediaPlayerTitleChanged           a
	       libvlc_MediaPlayerSnapshotTaken          a

We hope this can be useful to the community, if you have any feedback,
please feel free!
Thanks for a great product,
Yannick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vlc-plugin.patch
Type: text/x-patch
Size: 15908 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090901/d7c01605/attachment.bin>


More information about the vlc-devel mailing list