Rendering WebVTT in non-UA video players

Hi all,

I am getting increasing numbers of questions about the rendering of
WebVTT, in particular for those not proficient in reading the HTML
spec but still wanting to implement correct rendering.

The WebVTT spec explains in sufficient detail how Web UAs need to
render WebVTT cues.
Section 3.4 explains how cues and their content are mapped to DOM
nodes and Section 3.5 explains how layout and styling are applied.

For video players that are not Web UAs, however, there is much implied
work after the mapping to DOM nodes has happened and it becomes rather
complicated to create the same rendering when not going through a UA.

A simple example: if I author a cue with lots of spaces between the
individual words, those spaces are retained until the cue ends up as a
Text node in DocumentFragment. When this is rendered in a browser,
surplus whitespace disappears, because we are using pre-line (see bug
16889). This is a non-trivial detail that a WebVTT renderer has to
implement.

I don't really know what a good solution to this problem would be.
Writing sections for rendering in non-browsers (basically replicating
section 3.4 and 3.5) seems like duplication of effort. Has anyone got
a good idea?

Cheers,
Silvia.

Received on Wednesday, 22 August 2012 23:57:18 UTC