I am searching for a cross-browser video solution able to display local video using a local HTML file, with local subtitles (.srt files). I have tried different players (VideoJS, jwPlayer, HTML5 native with jquery.srt, etc.). All works fine when hosted online but none seems to work properly when local.
Unfortunately I can't install any web server or use third party extension.
Anyone have already solved this ?
HTML5 using the track tag with .vtt files (or .srt files with jquery.srt) : Works perfectly with IE10+ but not with Chrome 40+ (same comment here Viewing HTML5 video with captions offline)
<video controls preload="none" width="800" height="600" poster="test.jpg">
<source src="test.mp4" type='video/mp4' />
<track kind="subtitles" src="test_EN.vtt" srclang="en" label="English"></track>
<track kind="subtitles" src="test_FR.vtt" srclang="fr" label="French"></track>
</video>
jwPlayer v6 doesn't work offline, you get this message : "Offline playback not supported". After few search you can make the video work by using the jwPlayer v5 .swf file but... subtitles will not work.
<script type="text/javascript" src="jwplayer.js"></script>
<div id="oplayer">Loading the player...</div>
<script type="text/javascript">
jwplayer("oplayer").setup({file:"test.mp4",
image:"test.jpg",width:800,height:600,top:10,left:10,autostart:false,
tracks:[{file:"test_FR.srt",label:"FR",kind:"captions","default":true},
{file:"test_EN.srt",label:"EN",kind:"captions","default":true}]});
</script>
videoJS is also using HTML5 so, same behavior.
NB :
If you want to bypass the local issue with Chrome, you can launch the browser from the command line window with the additional argument ‘–allow-file-access-from-files’
src: http://www.chrome-allow-file-access-from-file.com/
var subtitle = "V0VCVlRUDQoNCjENCjAwOjAwOjI4Ljg5NSAtLT4g...";
subtitle = window.atob(subtitle);
var subBlob = new Blob([subtitle]);
var subURL = URL.createObjectURL(subBlob);
document.getElementById("subtitle").setAttribute("src", subURL);
<video controls>
<source type="video/mp4" src="videoFile.mp4">
<track id="subtitle" kind="subtitles" srclang="en" label="English">
</video>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With