Ashraf Eldawody
Ashraf Eldawody

Reputation: 138

Is there any way to play srt subtitles in html5 player

i was looking for a way to run video with srt subtitle without converting it to vtt i tried to many players and all requires vtt, now i am working on videojs

    <video id="my-video" class="video-js" style="margin:0 auto;margin-bottom: 60px;" controls preload="auto" width="900" height="500" poster="poster.jpg" data-setup="{}">
    <source src="mp4.mp4" type='video/mp4'>
    <track kind='captions' src='srt.srt' srclang='en' label='English' />
    <track kind='captions' src='srt.srt' srclang='ar' label='Arabic' default />
  </video>

  <script src="http://vjs.zencdn.net/5.19.2/video.js"></script>js.zencdn.net/5.19.2/video.js"></script>

Upvotes: 2

Views: 2644

Answers (1)

Lalit Sachdeva
Lalit Sachdeva

Reputation: 6619

So SRT files happened to work with versions of VideoJS up to 4.11, even though they weren't officially supported, but SRTs no longer work in 4.12 (because of the use of vtt.js, which greatly improves support for WebVTT files). This isn't specifically documented.

And for your quick results either you downgrade your video.js to 4.11 or use bubbel.js here is one of the example implemented with bubble.js

https://github.com/pkalogiros/BubblesJS/blob/master/example.html

Upvotes: 1

Related Questions