Skip to content

fix(DORIS-2053): apply WebVTT cue settings when dispatchForManualRendering is enabled - #69

Open
eowino wants to merge 1 commit into
master-dorisfrom
fix/DORIS-2053-vtt-cue-settings-manual-rendering
Open

fix(DORIS-2053): apply WebVTT cue settings when dispatchForManualRendering is enabled#69
eowino wants to merge 1 commit into
master-dorisfrom
fix/DORIS-2053-vtt-cue-settings-manual-rendering

Conversation

@eowino

@eowino eowino commented Aug 5, 2026

Copy link
Copy Markdown

Problem

TextTracks.addCaptions picks the cue-construction path based on the dispatchForManualRendering setting:

if (dispatchForManualRendering) {
    cue = _handleCaptionEvents(currentItem, timeOffset);        // did NOT apply styles
} else if (_isHTMLCue(currentItem) && captionContainer) {
    cue = _handleHtmlCaption(currentItem, timeOffset, track);
} else if (currentItem.data) {
    cue = _handleNonHtmlCaption(currentItem, timeOffset, track); // applied styles
}

Only _handleNonHtmlCaption copied currentItem.styles onto the cue. With dispatchForManualRendering: true, _handleCaptionEvents returned the cue unstyled, so align / line / position / size parsed out of the WebVTT were silently dropped and every cue rendered bottom-centre regardless of its cue settings.

VTTParser was never at fault — it returns the settings correctly. They were discarded downstream.

Fix

Move the style application out of _handleNonHtmlCaption into _getCueInformationForNonHtml, the constructor every non-HTML path funnels through via _getCueInformation.

Fixing the shared constructor rather than the one broken caller also covers _appendFragmentedWebVtt (wvtt in fMP4), which had the identical defect. The HTML/TTML path (_getCueInformationForHtml) is untouched.

Behavioural note: settings are now applied during cue construction rather than after _getCueInformation returns. _handleCaptionEvents only deletes cue.type in onenter, and manualCueProcessing reads track.manualCueList — neither touches positioning.

…bled

TextTracks.addCaptions builds cues via _handleCaptionEvents when
dispatchForManualRendering is on, and that path returned the cue without
copying currentItem.styles onto it. align/line/position/size were silently
dropped, so every WebVTT cue rendered bottom-centre regardless of its cue
settings. Only _handleNonHtmlCaption applied them.

Move the style application into _getCueInformationForNonHtml so every
non-HTML path gets it, rather than fixing the one caller. This also covers
_appendFragmentedWebVtt (wvtt in fMP4), which was equally affected and has
no test coverage here. The HTML/TTML path is untouched.

Note the styles are now applied during cue construction rather than after
_getCueInformation returns.
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.

1 participant