How To Add Subtitles From A External Source In Html5?
I'm trying to add subtitles from an external source in a video html but I can't. I'm using the WebTorrent Technology, so, I'm streaming video torrents in my Browser and the
Solution 1:
You can create or include a <track> element within HTML as a child of parent <video> element with default property set to true, src to to .vtt file, kind set to "subtitles", mode set to "showing", label set to "Español", and srclang set to "es"
file.appendTo('body');
var video = document.querySelector("video");
var track = document.createElement("track");
track.mode = "showing";
track.label = "Español";
track.kind = "subtitles";
track.srclang = "es";
track.src = "subs.vtt";
track.default = true;
video.appendChild(track);
Post a Comment for "How To Add Subtitles From A External Source In Html5?"