metastream icon indicating copy to clipboard operation
metastream copied to clipboard

External subtitle support

Open Turkishlator opened this issue 5 years ago • 5 comments

It would be nice to add .srt or other subtitle formats as soft subtitles via external direct urls.

Turkishlator avatar Sep 01 '19 01:09 Turkishlator

Ideally I'd like to outsource these kinds of features to a web video player that supports this already. Do you know of any that do support the feature you're requesting?

samuelmaddock avatar Sep 01 '19 01:09 samuelmaddock

Well I'm not that very aware how these things works but usually jwplayer supports this kind of subtitles right?

Turkishlator avatar Sep 01 '19 16:09 Turkishlator

I was about to create a new issue for this feature request, then I found this one. So I will list my thoughts here!

Currently (in HTML5), video tag supports subtitles in modern browsers through track tag, and maybe supporting modern browsers is quite enough for this feature which would keep the implementation simple and native.

I tried it with a local HTML, video, and .srt files. And it worked! I did clone the repo but seems like it will take me some time to get to know the codebase. So, I thought about sharing my idea here at a glance.

Here is my suggestion on how it can be achieved:

  • A new ButtonListItem labelled "Load Subtitle", in the MoreButton
  • Clicking it asks for SRT file (file input)
  • Parse the SRT, convert it to WebVTT (done here and here, and seems to be very few string manipulations and prepending)
  • Convert/Encode the WebVTT file to data URL (sample online tool)
  • Locate the <video> tag (which obviously already happening in the app)
  • Append to children <track> tag with the subtitle data URL in src attribute <track default kind="subtitle" src="VTT_DATA_URL" />

Looking forward to what you think! @samuelmaddock

hossam-magdy avatar Apr 07 '20 23:04 hossam-magdy

any hack for now?

fabianski7 avatar Sep 05 '21 00:09 fabianski7

any hack for now?

I use this extension for now https://chrome.google.com/webstore/detail/substital-add-subtitles-t/kkkbiiikppgjdiebcabomlbidfodipjg?hl=en

llsanketll avatar Oct 16 '22 14:10 llsanketll