Skip to content

fix(media-groups): set text track kind to captions based on HLS characteristics - #1616

Open
amtins wants to merge 1 commit into
videojs:mainfrom
amtins:fix/hls-characteristics
Open

amtins wants to merge 1 commit into
videojs:mainfrom
amtins:fix/hls-characteristics

Conversation

@amtins

@amtins amtins commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

Previously, all HLS SUBTITLES media group renditions were assigned the
'subtitles' text track kind by default.

According to the W3C and WHATWG HTML standards, tracks that transcribe dialogue
or describe music and sounds are called captions. They're intended to help
people who are deaf or hard of hearing.

The HLS RFC 8216 standard allows CHARACTERISTICS to contain several
comma-separated values, such as public.easy-to-read. The kind is now
determined by checking each value separately.

Specifications references:

Specific Changes proposed

  • add a private function named textTrackKind_ that will determine the correct kind
  • add test cases

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
  • Reviewed by Two Core Contributors

@welcome

welcome Bot commented Oct 17, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖

Things that will help get your PR across the finish line:

  • Run npm run lint -- --errors locally to catch formatting errors earlier.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.03%. Comparing base (a9f9d7a) to head (af45ac6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1616      +/-   ##
==========================================
+ Coverage   84.00%   84.03%   +0.02%     
==========================================
  Files          44       44              
  Lines       11713    11720       +7     
  Branches     2625     2629       +4     
==========================================
+ Hits         9840     9849       +9     
+ Misses       1873     1871       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…cteristics

Previously, all HLS SUBTITLES media group renditions were assigned the
'subtitles' text track kind by default.

According to the W3C and WHATWG HTML standards, tracks that transcribe dialogue
or describe music and sounds are called **captions**. They're intended to help
people who are deaf or hard of hearing.

The HLS RFC 8216 standard allows `CHARACTERISTICS` to contain several
comma-separated values, such as `public.easy-to-read`. The kind is now
determined by checking each value separately.

Specifications references:

- HLS RFC 8216 Section 4.3.4.1 (ref Characteristics):
  https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.4.1
  ```text
  A SUBTITLES Rendition MAY include the following characteristics:
      "public.accessibility.transcribes-spoken-dialog",
      "public.accessibility.describes-music-and-sound", and
      "public.easy-to-read" (which indicates that the subtitles have
      been edited for ease of reading).
  ```

- HLS RFC 8216 Section 8.9:
  https://datatracker.ietf.org/doc/html/rfc8216#section-8.9
  ```text
  CHARACTERISTICS Attribute Containing Multiple Characteristics

   Certain characteristics are valid in combination, as in:

   CHARACTERISTICS=
   "public.accessibility.transcribes-spoken-dialog,public.easy-to-read"
  ```

- WHATWG HTML / W3C HTML5 Track Kind 'captions':
  https://html.spec.whatwg.org/multipage/media.html#attr-track-kind-keyword-captions
  https://www.w3.org/TR/2011/WD-html5-20110113/video.html#the-track-element
  ```text
  captions

      Closed captions provide transcription or translation of the dialog, sound effects, relevant musical cues, and other relevant audio information, such as the cue's source (e.g., character, environment). They are suitable for when sound is unavailable or not clearly audible (e.g., because it is muted, drowned-out by ambient noise, or because the user is deaf).
  ```

- add a private function named `textTrackKind_` that will determine the correct kind
- add test cases

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants