Embeding VLC with subtitles (Can't get vlc.subtitle.track working)

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
mattgrimley
New Cone
New Cone
Posts: 7
Joined: 03 Oct 2014 12:47

Embeding VLC with subtitles (Can't get vlc.subtitle.track working)

Postby mattgrimley » 01 Dec 2015 12:54

Hi there,
Sorry if this has already been addressed.. i'm slightly over-reaching my technical ability and i may have mis-searched.. (though i have been looking).

I have a tv-headEnd server broadcasting a stream which i embed in a webpage with subtitles enabled. I came up with / discovered the following html which has worked fine up until 2.2.1 (it works in 2.2.0 at the very least) and i can't work out what im doing wrong.

The html is quite simple and looks like this:

Code: Select all

<html> <head> <title>VLC WebPlayer Start Subtitles and Mute Video on page load</title> <script type="text/javascript"> function subtitles() { var vlc = document.getElementById("vlc"); vlc.subtitle.track='505'; vlc.video.deinterlace.enable("blend") } function start(){ timeout = setTimeout(subtitles,1000); } </script> </head> <body bgcolor="#000000" onload=start()> <object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" width="100%" height="100%" id="vlc" events="True"> <param name="Src" value="http://username:password@hostname:9981/playlist/channelid/33" /> <param name="ShowDisplay" value="False" /> <param name="AutoLoop" value="False" /> <param name="Controls" value="False" /> <param name="AutoPlay" value="True" /> </object> </body> </html>
Can anyone advise if it's simply my bad code which no longer works, or if this might be a bug in the latest (the the current nightly of 2.2.2) version, or possibly even a deprecated function? I'm thinking it's going to be my code.. but.. i'm stuck!

The timeout line was added because the plugin was prone to loading a black screen without it and that seemed to cause a refresh of the display and made it work.

Thanks in advance of any help and sorry if i'm in the wrong place or duplicating an existing post!!

mattgrimley
New Cone
New Cone
Posts: 7
Joined: 03 Oct 2014 12:47

Re: Embeding VLC with subtitles (Can't get vlc.subtitle.track working)

Postby mattgrimley » 01 Dec 2015 12:57

actually forgot to describe my issue! LOL

So, the subtitles aren't appearing. But, if i downgrade VLC from 2.2.1 to 2.2.0 they work fine.
The F12 debugger in internet explorer gives me an "Invalid procedure call or argument" on the

Code: Select all

vlc.subtitle.track='505';
line.

Thanks!

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

Re: Embeding VLC with subtitles (Can't get vlc.subtitle.track working)

Postby da2424 » 01 Dec 2015 16:56

The plugin no longer uses the original subtitle PID. It uses an array index.

Example:
  • 0 = Subtitle disabled
  • 1 = First available subtitle
  • 2 = Second available subtitle
  • ...
This should work:

Code: Select all

vlc.subtitle.track = 1;

mattgrimley
New Cone
New Cone
Posts: 7
Joined: 03 Oct 2014 12:47

Re: Embeding VLC with subtitles (Can't get vlc.subtitle.track working)

Postby mattgrimley » 02 Dec 2015 10:20

Ahh, you genius. Thank-you so much!

That was exactly my problem. I owe you a virtual beer @da2424 :D

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

Re: Embeding VLC with subtitles (Can't get vlc.subtitle.track working)

Postby da2424 » 02 Dec 2015 12:21

No problem ;)


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 25 guests