Skip to content

Captions: don't preload until necessary #1791

Open
@theprojectsomething

Description

Currently any TextTrack elements are being downloaded as soon as they're associated with a player. It would be great if the behaviour was a little closer to the browser e.g:

  • individual tracks are fetched only when they're needed (ideal), so on metadata or play / scrub
  • alternatively only the active track is fetched initially on load, with others requested as they become active

VTTs are generally pretty small, so this really isn't a problem when you've only got one player on a page with one track. But if you've got more than one player with more than one track, then you end up with a whole bunch of content you don't need. In my case I'm working with 5-10 players per page with 100+ tracks (translations) per video, so it's going to get a bit connection heavy.

Looking at the codebase, it looks like things are stemming from captions.update() where mode="hidden" is being set on every track. I'm wondering if there is a reason for this (I'm guessing a safari/IE quirk) or if it's possible to set the mode="disabled" instead, and then set the default track to mode="hidden" only when it's needed.

Just a thought starter. Happy to put together a PR if there's a concensus. Thanks for reading.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions