Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to load captions/subtitles from file not listed in the manifest #3572

Open
malthejorgensen opened this issue Mar 13, 2021 · 3 comments

Comments

@malthejorgensen
Copy link

malthejorgensen commented Mar 13, 2021

Is your feature request related to a problem? Please describe.
I have a use-case in my company where it's impractical to add captions to the manifest files once they've been produced.
We already have a large number of manifest files with no captions listed, since the video is produced first and captions added later. Customers would like to upload captions for these videos in cases where it makes sense.

For that reason, it would be nice to be able to load captions from a source that is not listed in the manifest file.

A similar use case could be the dash.js sample here: https://reference.dashif.org/dash.js/latest/samples/captioning/caption_vtt.html.
The sample doesn't work since the manifest file it loads lists the captions as an http://-URL while the page is loaded via https://. Modern browsers like Chrome will block the request fetching the captions since it's Mixed-Content: Loading a http://-resource from a https://-Origin. This is different from my own issue, but can be solved in the same way – by allowing loading of captions from outside the manifest.

Describe the solution you'd like
I'd like for dash.js to support loading captions from sources not listed in the manifest.

Describe alternatives you've considered
Players like Plyr and Video.js fully rely on Dash.js for caption playback, so it's not possible to load external captions that way either.

Additional context
I've made a proof-of-concept PR here: #3573
I'm happy to adjust it to the style and requirements of this project.

@dsilhavy
Copy link
Collaborator

@malthejorgensen That sounds like a very nice addition. Regarding #3573 : Is this ready for review or are you still changing some parts?

@dsilhavy dsilhavy added this to the 3.3.0 milestone Mar 16, 2021
@dsilhavy dsilhavy self-assigned this Mar 16, 2021
@malthejorgensen
Copy link
Author

malthejorgensen commented Mar 16, 2021

Hi @dsilhavy. The PR is now in a reviewable state, but not finalized since I'd like someone more experienced with this codebase than me (that person is probably you 😁) to consider these parts of the PR:

  • It duplicates code from TextSourceBuffer.createTextTrackFromMediaInfo
  • I'm unclear about how to handle errors in various cases
  • It adds TextTracks.getNumberOfTextTracks() since we need the total number of text tracks to call TextTracks.addTextTracks()
  • In TypeScript it uses the MediaInfo type which isn't constructible (it's not exported from the package), but since TypeScript is structurally typed I think passing in an object with the right properties should still work.
  • Potentially adds code to MediaPlayer that should live somewhere else?

If the current structure is okay, I'll finish it up. But also very open to moving things around so that they are more aligned with the codebase.

@dsilhavy dsilhavy modified the milestones: 3.2.2, 4.0.0 Apr 6, 2021
@dsilhavy dsilhavy modified the milestones: 4.0.0, 4.0.1 May 28, 2021
@dsilhavy dsilhavy removed this from the 4.0.1 milestone Jun 27, 2021
@giorgos-epitropou-obs
Copy link

Hi, any update? I see a lot of traction along with the DVB subtitles spec and I was wondering if this will be implemented too as it is very similar

@dsilhavy dsilhavy added this to the 5.0.0 milestone Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants