vlc.addEventListener does not fire any event

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
Evil.2000
New Cone
New Cone
Posts: 1
Joined: 08 Jun 2010 16:30

vlc.addEventListener does not fire any event

Postby Evil.2000 » 08 Jun 2010 16:49

Hi!

I'm using VLC 1.0.5 with ActiveX and Mozilla Plugin on Windows and Gentoo Linux. On all Systems i register the events listed on http://wiki.videolan.org/Documentation: ... oot_object with addEventListener()-Method. But the events get not fired.

Here's the code i use:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/Strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Video</title> </head> <body topmargin="0" leftmargin="0"> <embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" width="320" height="240" id="player"></embed> <script type="text/javascript"> //<![CDATA[ var vlc = document.getElementById('player'); var registerVLCEvent = function(event, handler) { if (vlc) { if (vlc.attachEvent) { // Microsoft vlc.attachEvent (event, handler); } else if (vlc.addEventListener) { // Mozilla: DOM level 2 //vlc.addEventListener (event, handler, false); vlc.addEventListener(event,handler,false); } else { // DOM level 0 eval("vlc.on" + event + " = handler"); } } } // event callback function for testing var handleEvents = function (event) { alert('event'); if (!event) event = window.event; // IE if (event.target) { // Netscape based browser targ = event.target; } else if (event.srcElement) { // ActiveX targ = event.srcElement; } else { // No event object, just the value alert("Event value" + event ); return; } if (targ.nodeType == 3) // defeat Safari bug targ = targ.parentNode; alert("Event " + event.type + " has fired from " + targ ); } registerVLCEvent('MediaPlayerNothingSpecial', handleEvents); registerVLCEvent('MediaPlayerOpening', handleEvents); registerVLCEvent('MediaPlayerBuffering', handleEvents); registerVLCEvent('MediaPlayerPlaying', handleEvents); registerVLCEvent('MediaPlayerPaused', handleEvents); registerVLCEvent('MediaPlayerForward', handleEvents); registerVLCEvent('MediaPlayerBackward', handleEvents); registerVLCEvent('MediaPlayerEncounteredError', handleEvents); registerVLCEvent('MediaPlayerEndReached', handleEvents); registerVLCEvent('MediaPlayerTimeChanged', handleEvents); registerVLCEvent('MediaPlayerPositionChanged', handleEvents); registerVLCEvent('MediaPlayerSeekableChanged', handleEvents); registerVLCEvent('MediaPlayerPausableChanged', handleEvents); var url = 'http://'+window.location.host+'/gui/video.flv'; vlc.playlist.add(url," ","no-video-title-show"); vlc.playlist.play(); //]]> </script> </body> </html>
As you can see, an alert box should appear on video playback, or stop, but nothing is happening.
I tried with IE 6,7,8 on Windows XP with VLC ActiveX control,
with Firefox 3.5.5 on Windows XP with Mozilla Plugin and with Firefox 3.6.3 on Gentoo Linux.
It doesn't work on one of the Browsers.

I took a look into the vlc-plugin source code to find if the event-functions are implemented but i seems that it is not implemented yet.
Am I using the wrong VLC version or why isn't the event-handling working?

Regards.

Evil

thanaos
Blank Cone
Blank Cone
Posts: 10
Joined: 10 May 2010 09:27

Re: vlc.addEventListener does not fire any event

Postby thanaos » 09 Jun 2010 08:15

I have the same pb !

jack.ting
Blank Cone
Blank Cone
Posts: 35
Joined: 19 Jan 2011 04:04

Re: vlc.addEventListener does not fire any event

Postby jack.ting » 10 Feb 2011 08:46

Hi, there:

I found that the FireFox bowser has trouble on "addEventListener()" function.
The vlc.addEventListener does exist, but the Event Handler can not registered successfully, so...
You've to fall back to DOM Level 0.
Modily the registerVLCEvent() function as follow, pls.

Code: Select all

var registerVLCEvent = function(event, handler) { if (vlc) { if (vlc.attachEvent) vlc.attachEvent (event, handler); else eval("vlc.on" + event + " = handler"); } }

cabana80
New Cone
New Cone
Posts: 1
Joined: 24 Mar 2011 12:41

Re: vlc.addEventListener does not fire any event

Postby cabana80 » 24 Mar 2011 13:58

Hi jack.ting,

I managed to register the "MediaPlayerEndReached" event in IE9 with VLC 1.1.5, but not in Firefox 4. In Firefox I tried all of the following:

vlc.MediaPlayerReached = doNext;
vlc.onMediaPlayerReached = doNext;
vlc['MediaPlayerReached'] = doNext;
vlc['onMediaPlayerReached'] = doNext;

Where doNext() is a function as in your other example here: viewtopic.php?t=84279#p286741.

Could you please confirm that you were able to register the DOM event in Firefox? If so, what versions of Firefox and VLC did you use? Could you also provide a short sample code of the exact event listener call?

Thanks!

jack.ting
Blank Cone
Blank Cone
Posts: 35
Joined: 19 Jan 2011 04:04

Re: vlc.addEventListener does not fire any event

Postby jack.ting » 13 Jun 2011 06:04

Hi cabana80,

Sorry, for late respond.

I use still using 3.6.15.
the complete example as the following

Code: Select all

function regVLCEvent(tobj, type, func) { if (tobj.attachEvent) tobj.attachEvent(type, func); // else if (tobj.addEventListener) // tobj.addEventListener(type, func, true); else tobj["on" + type] = func; } ... var my_vlc = new Object(); ... my_vlc = document.getElementbyId('vlc_id'); ... regVLCEvent(my_vlc, 'MediaPlayerEndReached', doNext);
so, it should be simular to the 4th of your tries.

Yansky
Blank Cone
Blank Cone
Posts: 11
Joined: 24 Aug 2010 02:32

Re: vlc.addEventListener does not fire any event

Postby Yansky » 19 Jul 2011 09:30

Are the event handlers still not implemented in the Mozilla version of the plugin?

jml674
Blank Cone
Blank Cone
Posts: 38
Joined: 03 Feb 2010 19:54
Location: France

Re: vlc.addEventListener does not fire any event

Postby jml674 » 20 Dec 2011 16:03

Hello, I'm currently trying to understand what's going on with on with the AddEventListener method of the 1.1 plugin with FIREFOX.
A few preliminary remarks:
- it does not fire the handler you specify although most of the code seems to work fine.
- for a successful registration , you need to have the player playing (that was not obvious to me).
Note: you should not rely on any other method than "player.addEventListener("

I have not studied the ActiveX version due to lack of compilation environment and will not.

JustinWyllie
New Cone
New Cone
Posts: 5
Joined: 19 Dec 2011 15:22

Re: vlc.addEventListener does not fire any event

Postby JustinWyllie » 21 Dec 2011 16:10

I'm told by my c developer that the events system was added as a patch but then 'unimplemented' by the main developers. It does not work.

jml674
Blank Cone
Blank Cone
Posts: 38
Joined: 03 Feb 2010 19:54
Location: France

Re: vlc.addEventListener does not fire any event

Postby jml674 » 22 Dec 2011 14:33

Not sure. Troubleshooting the code, I was able to evidence:
- the events are properly registered in the vlc internal structure
- they are properly fired within vlc thread
- however and despite the fact the propper callback function address is used when the event fires, the call has not effect within the firefox environment ie the javascript handler is not called.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: vlc.addEventListener does not fire any event

Postby RSATom » 24 Dec 2011 08:37

added support of addEventListener to windows version:
http://mailman.videolan.org/pipermail/v ... 84379.html

builded version:
http://code.google.com/p/vc-axnp-vlc/downloads/list

jml674
Blank Cone
Blank Cone
Posts: 38
Joined: 03 Feb 2010 19:54
Location: France

Re: vlc.addEventListener does not fire any event

Postby jml674 » 07 Jan 2012 11:10

Thanks Sergey !

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: vlc.addEventListener does not fire any event

Postby RSATom » 07 Jan 2012 12:37

you are wellcome!

Mark Lesha
New Cone
New Cone
Posts: 6
Joined: 22 Feb 2012 07:03

Re: vlc.addEventListener does not fire any event

Postby Mark Lesha » 22 Feb 2012 07:10

We are using the VLC 2.1.0 Mozilla plugin with Firefox, and we noted the same problem. i.e. we cannot get event handlers to register clicks on the embedded video image in the browser. This would be really useful to us, since we could use it to place markers on the incoming video, etc.

Your patch sounds really good. But I think we need an updated npvlc.dll for Firefox, instead of axvlc.dll (which is for IE). Am I right?

I'm not sure if we could be clever enough to set up our own source builds, but I guess we could try :)

Will your patch find its way into the 2.1.0 nightly builds some time?

Mark Lesha
New Cone
New Cone
Posts: 6
Joined: 22 Feb 2012 07:03

Re: vlc.addEventListener does not fire any event

Postby Mark Lesha » 22 Feb 2012 07:35

I forgot to mention, we are running Windows XP, and Firefox 10 with VLC 2.1.0 nightly build from 18/02/12

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: vlc.addEventListener does not fire any event

Postby RSATom » 22 Feb 2012 09:22

this patch already applied, but it's not related to catching mouse events in JS. At this time there are no way to catch mouse clicking.

drdim
New Cone
New Cone
Posts: 3
Joined: 27 Feb 2012 05:51

Re: vlc.addEventListener does not fire any event

Postby drdim » 27 Feb 2012 05:58

Hello!

Thanks for fixing "addEventListener" !

But, There is a lack of "volumechange" event:
volume can be changed or muted throught plugin controls or with keyboard/mouse and from javascript i want to know when volume is changed. Currently, i do it checking vlc.audio.volume periodically, but listening "volumechange" will be more good solution.

Tuizi
New Cone
New Cone
Posts: 7
Joined: 27 Jul 2012 23:11

Re: vlc.addEventListener does not fire any event

Postby Tuizi » 27 Jul 2012 23:14

Today, what is the solution to catch the event "MediaPlayerOpening" on Chome?
The solution of the custom ActiveX doesn't work, and the official version doesn't too.

Thank you for your help :D

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: vlc.addEventListener does not fire any event

Postby RSATom » 28 Jul 2012 04:00


Tuizi
New Cone
New Cone
Posts: 7
Joined: 27 Jul 2012 23:11

Re: vlc.addEventListener does not fire any event

Postby Tuizi » 29 Jul 2012 03:55

Events only work with Firefox with FBVLC too.... :(

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: vlc.addEventListener does not fire any event

Postby RSATom » 29 Jul 2012 05:18

hm... it's very strange... all events does not work or only some of them?

Tuizi
New Cone
New Cone
Posts: 7
Joined: 27 Jul 2012 23:11

Re: vlc.addEventListener does not fire any event

Postby Tuizi » 29 Jul 2012 08:03

It's OK! :) It's work... a little... I'm searching what is the problem, what is wrong...

For exemple if I launch file:///C:/demo/FBVLC_0.0.0.6.htm it's ok, but If a lauch the same file by http:// (http://localhost/demo/FBVLC_0.0.0.6.htm) I'll get an error:

Code: Select all

Error in event handler for 'undefined': Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at X (eval at <anonymous> (chrome-extension://phahnhbgfdhgobenebnjbgmacgpbfaag/includes/wombat_content.js:11:30)) at Ka (eval at <anonymous> (chrome-extension://phahnhbgfdhgobenebnjbgmacgpbfaag/includes/wombat_content.js:11:30)) at eval at <anonymous> (chrome-extension://phahnhbgfdhgobenebnjbgmacgpbfaag/includes/wombat_content.js:11:30) at eval at <anonymous> (chrome-extension://phahnhbgfdhgobenebnjbgmacgpbfaag/includes/wombat_content.js:11:30) at miscellaneous_bindings:283:9 at [object Object].dispatch (event_bindings:203:41) at Object.<anonymous> (miscellaneous_bindings:250:22)

Tuizi
New Cone
New Cone
Posts: 7
Joined: 27 Jul 2012 23:11

Re: vlc.addEventListener does not fire any event

Postby Tuizi » 29 Jul 2012 18:06

In first time, thank you for your plugin FBVLC, it's perfect ;)
I have one last question, how switch to fullscreen? The toggleFullscreen method doesn't work.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: vlc.addEventListener does not fire any event

Postby RSATom » 29 Jul 2012 18:12

fullscreen works now only in windowed mode

Tuizi
New Cone
New Cone
Posts: 7
Joined: 27 Jul 2012 23:11

Re: vlc.addEventListener does not fire any event

Postby Tuizi » 29 Jul 2012 20:50

With toggleFullscreen method? how?

Code: Select all

TypeError: Property 'toggleFullscreen' of object <JSAPI-Auto Javascript Object> is not a function

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: vlc.addEventListener does not fire any event

Postby RSATom » 30 Jul 2012 03:32

Maybe it's a bug. I'll check. Anyway, you can use double clicking on player area.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 13 guests