Skip to content

Add WebVTT header metadata to disambiguate metadata cues (#511)#548

Open
cookiecrook wants to merge 11 commits into
w3c:mainfrom
cookiecrook:header-block
Open

Add WebVTT header metadata to disambiguate metadata cues (#511)#548
cookiecrook wants to merge 11 commits into
w3c:mainfrom
cookiecrook:header-block

Conversation

@cookiecrook

@cookiecrook cookiecrook commented May 28, 2026

Copy link
Copy Markdown

Replaces the ATTRIBUTES-block approach explored in #523 with the TTWG-consensus design: file-level key/value pairs are written on the lines immediately following the WEBVTT file header line and are terminated by a blank line, rather than living in a separate block.

Key behaviors per the April 23 + May 7 TTWG meeting consensus and follow-up review comments:

Closes #511. Defers HTML-integration details (precedence between VTT header metadata and attributes, processing model) to whatwg/html#11665.

Note: GenAI (Claude Opus 4.8) used in the creation of this latest iteration.


Preview | Diff

Replaces the ATTRIBUTES-block approach explored in w3c#523 with the
TTWG-consensus design: file-level key/value pairs are written on the
lines immediately following the WEBVTT file header line and are
terminated by a blank line, rather than living in a separate block.

Key behaviors per the April 23 + May 7 TTWG meeting consensus and
follow-up review comments:

- Reserves four header keys: lang, kind, label, type (all optional;
  lang aligns with HTML <track srclang>; type addresses w3c#511 by
  identifying metadata schemas, with the taxonomy work continuing in
  w3c#512).
- Accepts both ":" and "=" as separators; "=" is permitted for
  HLS-compatible files but is marked non-recommended.
- Matches reserved keys case-sensitively; authors must use lowercase.
- Allows Unicode in keys and values, excluding bidi controls, line
  breaks, and the "-->" substring.
- Requires non-reserved keys to contain a hyphen and not start with
  one, reserving the hyphen-free namespace for future standardization.
- Parses leniently: invalid lines are ignored individually and do not
  invalidate the rest of the header; no parser warnings are required.
- Adds the parser plumbing (a new |header metadata| slot on the parser
  signature, a "collect WebVTT header metadata" algorithm, and a new
  return path from "collect a WebVTT block" when the in-header flag is
  set).
- Updates the WebVTT metadata text prose to recommend declaring kind
  and type for files delivered outside an HTML context, addressing
  the cue-format ambiguity from w3c#511.

Closes w3c#511. Defers HTML-integration details (precedence between VTT
header metadata and <track> attributes, processing model) to
whatwg/html#11665.
Comment thread index.bs Outdated
Comment thread index.bs
Comment thread index.bs Outdated
Comment thread index.bs
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
- Data model: explicitly state that unrecognized pairs are preserved
  only when the key meets the hyphen requirement; pairs that don't
  are dropped by the parser. Explains the webcompat motivation for
  reserving the unhyphenated key-name space.
- Reframe the `type` reserved key as a name reservation with no
  values defined here; defer the registry (with `video.strobing.
  general-flash` as the expected first entry) to w3c#512. Drop the now
  redundant "future revision" note.
- Replace duplicated reserved-key lists in the syntax section and in
  the "collect WebVTT header metadata" algorithm with references to
  the data-model section.
- Drop the "opaque" framing in the metadata-text paragraph per
  Nigel's earlier objection.
- Remove the parenthetical formatting from the parser's "ignore
  invalid line" step.
@cookiecrook cookiecrook mentioned this pull request May 28, 2026
Addresses a missed cleanup from PR w3c#548 feedback. Removes the hardcoded count
of "four" reserved keys in the parser notes, and corrects the explanation of
how incorrectly-cased keys are handled (they are ignored immediately due to
lacking a hyphen, rather than being collected as unrecognized pairs).
@himorin

himorin commented May 30, 2026

Copy link
Copy Markdown
Contributor

@cookiecrook
pr-preview will remove lines in description after last of certain line, like <!-- or ***. I don't think automatic line by Claude will include such, but it is possible to be added to the bottom after pr-preview added (so, in result, order of <description-text> <pr-preview lines> <claude-lines> will be used, and latter two parts removed and new pr-preview lines added)
if you have any specific point to be considered, please file issue to https://github.com/tobie/pr-preview

(note, not sure what the WG has decided on usage of AI tool to generate specification text...)

@cookiecrook

cookiecrook commented Jun 1, 2026

Copy link
Copy Markdown
Author

Thanks. I discovered my error in the description and corrected it.

The context for others: I had commented wondering why PR Preview deleted the note about this being co-authored by GenAI, but deleted that comment once I discovered the reason and fixed the error. @himorin must've seen a record of the old comment in an older notification.

@nigelmegitt nigelmegitt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thought with no obvious place to comment on the changed files: in HTML there's a defined meaning to an attribute with no value, e.g. <div id="..." someattr> results in a DOM object that can be queried in javascript for the truthiness of someattr.

Would it make sense to match that here, and, in the absence of a : or = delimiter, if the entire line matches the requirements for a key, consider it to be a "true" attribute set on the file?

Comment thread index.bs Outdated
Comment on lines +1660 to +1667
<p>A <a>WebVTT header metadata key</a> must additionally satisfy one of the following:</p>

<ul>
<li>It is one of the keys reserved by this specification for <a>WebVTT header metadata</a>;
see [[#header-metadata]] for the current list of reserved keys.</li>
<li>It contains at least one U+002D HYPHEN-MINUS character, and its first character is not a
U+002D HYPHEN-MINUS character.</li>
</ul>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusingly presented. It means either one or the other condition must be met but that's very subtle - it took me several readings before I noticed the word "one" in line 1660 and realised that it means "exactly one".

There is more explanation in the note that follows, but it's too late (for this linear reader anyway!).

Suggest reformatting to be clearer that there are reserved keys, which are listed, and which contain no hyphen, and unreserved keys that can be defined by applications, which must contain at least one hyphen.

Then the note that follows could hopefully be removed or greatly reduced.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will modify. Thanks.

@cookiecrook cookiecrook Jul 1, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggled with this a bit… Here's the current version, which is now part of the previous list, rather than a separate "additionally" list.

  • [prior requirements for a key]
  • It must either match a reserved key, or must match the additional hyphenated formatting requirements of a custom key:
    • reserved key: Matches one of the keys reserved by this specification for WebVTT header metadata; see [[#header-metadata]] for the current list of reserved keys.
    • custom key: contains at least one U+002D HYPHEN-MINUS character, and its first character is not a U+002D HYPHEN-MINUS character.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nigelmegitt I think this is the last issue blocking review. All other review feedback has been resolved. Please let me know if you have additional comments. Thanks!

Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
@gkatsev

gkatsev commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Another thought with no obvious place to comment on the changed files: in HTML there's a defined meaning to an attribute with no value, e.g. <div id="..." someattr> results in a DOM object that can be queried in javascript for the truthiness of someattr.

Would it make sense to match that here, and, in the absence of a : or = delimiter, if the entire line matches the requirements for a key, consider it to be a "true" attribute set on the file?

I wonder whether we should allow it at the moment or to keep the scope smaller disallow it for now until this is asked for. I'd lean towards disallow at the moment, which I believe is currently covered by the parsing logic.

@gkatsev gkatsev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Seems like we're in a pretty good place with this PR now.

Comment thread index.bs
Comment thread index.bs Outdated
@gkatsev

gkatsev commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

one thing I noticed that isn't relevant to the contents of the PR is that in the diff preview extra whitespace is collapsed in the examples. So, everything is bunched up together.
image
Seems to be fine in the regular preview and the regular deploy.

@css-meeting-bot

Copy link
Copy Markdown
Member

The Timed Text Working Group just discussed Add WebVTT header metadata to disambiguate metadata cues (#511) w3c/dapt#548, and agreed to the following:

  • SUMMARY: Review and edits to continue; group reminded to check this PR.
The full IRC log of that discussion <nigel> Subtopic: Add WebVTT header metadata to disambiguate metadata cues (#511) w3c/dapt#548
<nigel> github: https://github.com//pull/548
<cpn> Gary: The new PR is out, in good shape but needs more reviews
<cpn> Nigel: You had a comment about something being too restrictive without benefit?
<cpn> Gary: It says that if you see a type that you don't recognise, you must not display it too the user. Is that necessary, as the expectation for metadata is that you don't display it
<cpn> ... But if the user forces metadata to be visible this would conflict with that. It seems unnecessary
<cpn> Gary: Does this assumes a new type value means a new form of metadata. But it could parse as VTT cues and be presented?
<cpn> s/Gary/Nigel/
<cpn> Gary: I think it's associated with kind metadata, but that may be an unnecessary restriction as well
<cpn> Nigel: I don't have a view right now, but something to think about
<cpn> Gary: You also made a clarification request, on the parsing steps
<cpn> Nigel: The rule is that a given rule key must not appear more than once in a WebVTT file. The first will be used. But what happens if it does appear more than once, is there an error state?
<cpn> Gary: Makes sense
<cpn> ... The parsing rules say there isn't an error generator
<nigel> Chris: Is the "must" guidance to authors?
<nigel> Gary: It's a lower-case "must" rather than an upper-case MUST
<nigel> Chris: If that's the case maybe it should explain that.
<cpn> Chris: Suggest rephrasing it to say "Authors should ... " as it's actually guidance to authors
<cpn> Gary: Yes
<cpn> ... We'll probably need WPTs for this
<cpn> Nigel: Having tests along with PRs is helpful
<cpn> Gary: I think that's everything on this PR
<cpn> Nigel: There are a few actions to take, based on the comments. One thing is subtle, about an unordered list. James said he'd modify that.
<cpn> Gary: So I don't think there's anything major left
<nigel> SUMMARY: Review and edits to continue; group reminded to check this PR.

Comment thread index.bs Outdated
Comment thread index.bs Outdated
Comment thread index.bs Outdated
Co-authored-by: James Craig <cookiecrook@users.noreply.github.com>
@cookiecrook

cookiecrook commented Jun 30, 2026

Copy link
Copy Markdown
Author

@nigelmegitt wrote:

Another thought with no obvious place to comment on the changed files: in HTML there's a defined meaning to an attribute with no value, e.g. <div id="..." someattr> results in a DOM object that can be queried in javascript for the truthiness of someattr.
Would it make sense to match that here, and, in the absence of a : or = delimiter, if the entire line matches the requirements for a key, consider it to be a "true" attribute set on the file?

@gkatsev replied

I wonder whether we should allow it at the moment or to keep the scope smaller disallow it for now until this is asked for. I'd lean towards disallow at the moment, which I believe is currently covered by the parsing logic.

I think Nigel is referring to Boolean attributes. If so, those are all implicitly false, but scope limited to specific Element definitions. For example, required is allowed on any form input element, but the checked attribute is only allowed on checkbox.

Without a way to limit the scope of which implicit Boolean metadata keys exist (like IDL provides for HTML elements), we'd be assigning permanent "falsy" values to every undefined key going forward. I agree with Gary that I'd prefer to keep the scope smaller now until a need is presented later.

@cookiecrook

Copy link
Copy Markdown
Author

@nigelmegitt I just fixed a few errant whitespace diffs I somehow missed previously. I think this is the only remaining discussion issue: a rewrote of some prose you correctly noted was confusingly phrased. Thanks for your review.

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.

VTT Metadata Cue format is ambiguous; some metadata may be unintentionally presented to the user in a context outside HTML

6 participants