Skip to content

Commit

Permalink
fix(WebVTT): Fix wrong writing-mode in nested cues (#5807)
Browse files Browse the repository at this point in the history
Fixes #4765

Backported to v4.3.x
  • Loading branch information
avelad authored and joeyparrish committed Feb 17, 2024
1 parent f0b34b6 commit f0c2c2d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/text/vtt_text_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,6 @@ shaka.text.VttTextParser = class {
cue = new shaka.text.Cue(start, end, '');
}

VttTextParser.parseCueStyles(payload, cue, styles);

// Parse optional settings.
parser.skipWhitespace();
let word = parser.readWord();
Expand All @@ -418,6 +416,8 @@ shaka.text.VttTextParser = class {
word = parser.readWord();
}

VttTextParser.parseCueStyles(payload, cue, styles);

if (id != null) {
cue.id = id;
}
Expand Down Expand Up @@ -688,6 +688,14 @@ shaka.text.VttTextParser = class {
static generateCueFromElement_(element, rootCue, cues, styles) {
const VttTextParser = shaka.text.VttTextParser;
const nestedCue = rootCue.clone();
// We don't want propagate some properties.
nestedCue.nestedCues = [];
nestedCue.payload = '';
// We don't want propagate some position settings
nestedCue.line = null;
nestedCue.region = new shaka.text.CueRegion();
nestedCue.position = null;
nestedCue.size = 0;
if (element.nodeType === Node.ELEMENT_NODE && element.nodeName) {
const bold = shaka.text.Cue.fontWeight.BOLD;
const italic = shaka.text.Cue.fontStyle.ITALIC;
Expand Down

0 comments on commit f0c2c2d

Please sign in to comment.