Page 1 of 1

Enabling captioning

Posted: 15 Jun 2009 22:27
by JonM
Greetings!

I am attempting to embed VideoLAN in a web page and I am running into two issues with closed captioning (or subtitles) from a video stream. The first question is how I can enable captioning when someone views the video stream by default, and the second question is how I can disable/enable captioning using javascript buttons on the website? I have looked at the Webplugin documentation (http://wiki.videolan.org/Documentation:WebPlugin) and I was not able to make things work.

The Javascript I have in the website has the following (Second question about enabling captions is under the doCaptions section in the code)

Code: Select all

<script type="text/ecmascript"><!-- function getVLC(name) { if (window.document[name]) { return window.document[name]; } if (navigator.appName.indexOf("Microsoft Internet")==-1) { if (document.embeds && document.embeds[name]) return document.embeds[name]; } else // if (navigator.appName.indexOf("Microsoft Internet")!=-1) { return document.getElementById(name); } } function updateVolume(deltaVol) { var vlc = getVLC("vlc"); vlc.audio.volume += deltaVol; document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%"; }; function doPlayOrStop() { var vlc = getVLC("vlc"); if( vlc.playlist.isPlaying ) { vlc.playlist.stop(); onStop(); } else if( vlc.playlist.items.count > 0 ) { vlc.playlist.play(); onPlay(); } else { // disable log } }; function doCaptions() { getVLC("vlc").video.subtitle = "1"; } function doStop() { getVLC("vlc").playlist.stop(); onStop(); }; function onPlay() { document.getElementById("PlayOrStop").value = " Stop "; document.getElementById("PlayOrStop").disabled = false; document.getElementById("Stop").disabled = false; }; function onStop() { var vlc = getVLC("vlc"); document.getElementById("PlayOrStop").value = " Play "; document.getElementById("PlayOrStop").disabled = false; }; //--> </script> <INPUT type=button id='PlayOrStop' value=' Stop ' onClick='doPlayOrStop();'> <INPUT type=button id='Captions' value=' Captions ' onClick='doCaptions();'> &nbsp; <INPUT type=button value=' Full Screen ' onClick='getVLC("vlc").video.toggleFullscreen();'> </SELECT> <SPAN style='text-align:center'>Volume:</SPAN> <INPUT type=button value=' - ' onClick='updateVolume(-10)'> <SPAN id='volumeTextField' style='text-align: center'>50%</SPAN> <INPUT type=button value=' + ' onClick='updateVolume(+10)'> <INPUT type=button value='Mute' onClick='getVLC("vlc").audio.toggleMute();'> <br><OBJECT classid='clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921' codebase='http://faq.php' width='704' height='480' id='vlc' events='True'> <param name='MRL' value='http://watch-tv/nbc.html' /> <param name='ShowDisplay' value='True' /> <param name='AutoLoop' value='False' /> <param name='AutoPlay' value='True' /> <param name='subtitle' value='True' /> <param name='video.subtitle' value='True' /> <param name='Volume' value='50' /> <param name='StartTime' value='0' /> <EMBED pluginspage='http://faq.php' type='application/x-vlc-plugin' progid='VideoLAN.VLCPlugin.2' width='704' height='480' name='vlc' target='http://watch-tv/nbc.html'> </EMBED>



The file, nbc.html, is relatively simple:

#EXTM3U
#EXTVLCOPT:vout-filter=deinterlace
#EXTVLCOPT:deinterlace-mode=blend
#EXTVLCOPT:access-filter=timeshift
udp://@239.255.1.9:1234

Re: Enabling captioning

Posted: 19 Jun 2009 04:22
by JonM
After investigating into the problem, I identified the issue is due to the fact I'm using an Apple client with Safari plug-in (version 0.8.6i) because there isn't a newer Web Browser plugin. Apple 0.8.6i plugin has captioning support disabled!

Captioning (Subtitles) works with Windows, so I'll be digging around to see if we can compile our own version of VideoLan for Apple computers. Any suggestions or pointers on how to do this well?