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

Yannick Bréhon y.brehon at qiplay.com
Wed Sep 9 16:37:16 CEST 2009

Sorry to bother you guys again before you got a chance to comment on the
latest release, but should I be committing this to git maybe, instead of
directly on the mailing list?

Yannick Bréhon a écrit :
> Here is our updated version of our patch to the plugin for enabling
> javascript reception of VLC events.
> We have changed it in the following way:
> - vlcplugin.addEventListener(callback, custom_parameter, <eventList>)
> will call the "callback" function, giving it the "custom_parameter"
> (which can be for instance a user-specified id). It is called:
> 	- as soon as any event is triggered if no eventList is given
> 	- as soon as an event of eventList is triggered. "eventList" is a
> string containing a list of event names, separated by commas and/or
> colons and/or semi-colons. Spaces are not separators but are ignored.
> The function returns True if all goes well, or a string with the error
> message otherwise. If any of the event in eventList does not exist, an
> error message is sent back to javascript, and the eventListener is not
> added.
> 	- Events in eventList must be one of: MediaPlayerOpening,
> MediaPlayerBuffering, MediaPlayerPlaying, MediaPlayerPaused,
> MediaPlayerStopped, MediaPlayerForward, MediaPlayerBackward,
> MediaPlayerEndReached, MediaPlayerEncounteredError,
> MediaPlayerTimeChanged, MediaPlayerPositionChanged,
> MediaPlayerTitleChanged, MediaPlayerSnapshotTaken.
> - vlcplugin.removeEventListeners() removes all current callbacks on a
> given plugin instance
> - we have protected the plugin to check what version of the plugin API
> is being used, so as to be still compatible with all browsers
> Details of implementation are visible in the patch itself.
> We hope this will satisfy the community's wishes, if you have any
> feedback, please feel free!
> Thanks!
> Yannick
> jpd at videolan.org a écrit :
>> On Wed, Sep 02, 2009 at 11:27:13AM +0200, Yannick Br?hon wrote:
>>> The question is: how would you imagine settig this mask on the
>>> javascript side?
>> Pass a list of event( name string)s you want to be sent. The plugin
>> will walk through the list at mask-setting-time and translate it into a
>> bitmap. This is O(N^2) unless you have a map prepared, but since setting
>> masks presumably occurs not very often compared to triggering events, I
>> don't mind even N linear searches. Event triggers cause a bitmap lookup
>> and a string table lookup in the master list, both by index and thus O(1).
>> Like I implied: separate interface and implementation details.
>> I think I would prefer clear/all/add/subtract/list over set/list, though.
>> (Excercise: Why?)
>>>> Worth a look then as it'd save code. If you come up with numbers please
>>>> share.
>>> OK, we just ran a few tests. Nothing complete or extremely serious, but
>>> still. Machine was a dual proc @ 1.66GHz, 2GB RAM. When catching all
>>> events (according to our "all" profile), proc was used at around 60%
>>> (for the browser). We didn't do much processing, just a simple test on
>>> the event name after catching an event. When catching only a single
>>> event (begin of video play), or no events, we were running at 55%. That
>>> is quite a difference, and would indeed justify the extra code...
>> What are you doing that eats 55% cpu on that box without events?
>> 5% cpu is not free so some filtering seems to be called for, yes.
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> http://mailman.videolan.org/listinfo/vlc-devel
>> ------------------------------------------------------------------------
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> http://mailman.videolan.org/listinfo/vlc-devel

More information about the vlc-devel mailing list