0

Say there is some website hosting a video that doesn't have an option for captions. Is there a way to "forcefully" attach captions to the <video> element from my side, for example by editing the DOM with Chrome? I've tried the following:

$("#video_id").append('<track label="English" kind="subtitles" srclang="en" src="https://websitefromotherdomain.com/subs.srt" default>')

This returns:

Unsafe attempt to load URL https://websitefromotherdomain.com/subs.srt from frame with URL https://video_domain.com/123.html. Domains, protocols and ports must match.

So this error is pretty self explanatory. But I was wondering if what I'd want to accomplish is even possible, and if there is another method for appending captions to a video (where the captions are hosted on a different website).

Brian Barry
  • 439
  • 2
  • 17
  • 1
    [similar](https://stackoverflow.com/questions/45902293/how-to-enable-cors-for-html5-video-loading-vtt-file) ? – James Aug 10 '21 at 20:14
  • Do you have example live links of a video and a `.srt` file so we can check and debug on our side? – AndrewL64 Aug 10 '21 at 20:14
  • You could always write a browser extension that would take a local file reference, create a blob URL, and add them that way. – Brad Aug 10 '21 at 20:25

0 Answers0