[webvtt] VTT Metadata Cue format is ambiguous; some metadata may be unintentionally presented to the user in a context outside HTML (#511)

cookiecrook has just created a new issue for https://github.com/w3c/webvtt:

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

Consider clarifying that metadata cues SHOULD or MUST be JSON-formatted, or at least be unambiguously formatted, such as starting with `{` and ending with `}\n\n` to retain backwards compatibility with the JSON usage documented in the VTT spec.

```webvtt
WEBVTT

1
00:00:10.123 --> 00:00:15.432
{
  key: "value"
}
```

### Background

[§ 4.2.1. WebVTT metadata text](https://w3c.github.io/webvtt/#metadata-text) (Normative) defines metadata text as:

> WebVTT metadata text consists of any sequence of zero or more characters other than U+000A LINE FEED (LF) characters and U+000D CARRIAGE RETURN (CR) characters, each optionally separated from the next by a WebVTT line terminator. (In other words, any text that does not have two consecutive WebVTT line terminators and does not start or end with a WebVTT line terminator.)
> 
> WebVTT metadata text cues are only useful for scripted applications (e.g. using the metadata text track kind in a HTML text track).

[§ 1.7. Metadata example](https://w3c.github.io/webvtt/#introduction-metadata) (Informative) clarifies: 

> A WebVTT file can consist of time-aligned metadata.
> 
> Metadata can be *any string* and is *often provided as a JSON construct*.

### Problem 

*"Metadata can be any string"* results in a format that is ambiguous, and therefore may be presented to the user unintentionally.

In an HTML `<video>` element, this ambiguity is resolved by the author providing a `kind="metadata"` attribute on the text track.

But there isn't a logical place to duplicate this disambiguation in some other VTT contexts, including when they are embedded in some media container formats.


### Proposed Solution

Consider clarifying that metadata cues SHOULD or MUST be JSON-formatted, or at least be unambiguously formatted, such as starting with `{` and ending with `}\n\n` to retain backwards compatibility with the JSON usage documented in the VTT spec.

Additional context for this change request coming in another issue.

- Todo: Link new VTT Type Proposal for Strobe Mitigation


Please view or discuss this issue at https://github.com/w3c/webvtt/issues/511 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 28 March 2023 04:39:39 UTC