1

I wrote code to insert subtitles in the video

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8"/>
        <title>name</title>

    <link rel = "stylesheet" href = "skript/video-js.min.css" />
    <script src = "skript/video.min.js"> </script>

    </head> 
<body>
<video
  class="video-js"
  controls
  preload="auto"
  width="640"
  height="264"
  data-setup='{}'>
  <source src="1.mp4" type="video/mp4">

    <track label="rus" kind="subtitles" srclang="ru" src="sub/rus.vtt"/>
    <track label="eng" kind="subtitles" srclang="en" src="sub/eng.vtt"/>

  </video>
</body>


</html>

But it does not work with browsers Opera, Chrome Is there any way to fix this?

1 Answer 1

0

Did you try to embed vtt/subtitles files in m3u8 package? It works with all browsers.

2
  • Sorry, but I do not fully understand you m3u8 is a video library. how is it related to subtitles? Do you suggest converting vtt in m3u8?
    – zeni1agent
    Commented Nov 5, 2018 at 9:51
  • Hi @zeni1agent, m3u8 is metadata file for streaming video (you are already using it under the hood, check urk in browser network). All stream urls are stored in this file and thats how player understand which segment to pull to play. Ref : [lifewire.com/m3u8-file-2621956] M3U8 can also contains metadata abt subtitles, so you have to just append your vtt file url in this file appropriately (sequence of reference is also important). Please search for "how to include subtile (vtt) files in m3u8" Commented Nov 5, 2018 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.