Cannot get javascript reference to embedded player

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
TheTheresa
New Cone
New Cone
Posts: 2
Joined: 10 Jan 2018 14:39

Cannot get javascript reference to embedded player

Postby TheTheresa » 10 Jan 2018 14:54

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!

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Cannot get javascript reference to embedded player

Postby da2424 » 11 Jan 2018 20:30

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

TheTheresa
New Cone
New Cone
Posts: 2
Joined: 10 Jan 2018 14:39

Re: Cannot get javascript reference to embedded player

Postby TheTheresa » 12 Jan 2018 07:12

Ok. Thanks!


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 10 guests