Page 1 of 1

Cannot get javascript reference to embedded player

Posted: 10 Jan 2018 14:54
by TheTheresa
Hi!

I have vlc player embedded in html code, the video is playing fine, but I cannot get a javascript reference to the player and can therefore not acces the javascript API. I do get a reference to the html element, but it is lacking all of the properties/functions of the vlc API. As far as I can see I'm following the examples in the documentation for the WebPlugin.

I'm using firefox v 57.0.4 for Windows.
I have vlc v. 2.2.8 installed with the Mozilla addOn.
(I have Windows 10, if that may be of any interest)

This is my code:

Code: Select all

<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://download.videolan.org/pub/videolan/vlc/last/win32/axvlc.cab" id="vlc"> <embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" src="http://www.html5videoplayer.net/videos/toystory.mp4" name="vlc" width="640" height="480" /> </object> <script type="text/javascript"> function test(){ var vlc = document.getElementById("vlc"); console.log(vlc.VersionInfo); } </script> <button onclick="test()">Run code</button>
When the code is run, vlc.VersionInfo is undefined. I have tried other properties/functions on the vlc object as well. But everything is undefined.
I'm invoking the code by clicking a button only to make sure that the vlc player has really been loaded.

Ps. I have also tried to embed the player without the object element like this:

Code: Select all

<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" src="http://www.html5videoplayer.net/videos/toystory.mp4" id="vlc" width="640" height="480" />
But that does not work either.

Greatful for help!

Re: Cannot get javascript reference to embedded player

Posted: 11 Jan 2018 20:30
by da2424
Since Firefox v52, NPAPI plugins like VLC web plugin will not longer be supported and Firefox will play the video with a own HTML5 player.
It will still work with Internet Explorer.
If you want to use Firefox (and other browsers), you could use the HTML5 media API: https://www.w3schools.com/tags/ref_av_dom.asp

Re: Cannot get javascript reference to embedded player

Posted: 12 Jan 2018 07:12
by TheTheresa
Ok. Thanks!