Skip to content

Commit

Permalink
fix(WebVTT): Fix wrong writing-mode in nested cues (#5641)
Browse files Browse the repository at this point in the history
Fixes #4765
  • Loading branch information
avelad authored and joeyparrish committed Sep 13, 2023
1 parent 3d7d5c8 commit 8a7e32e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/text/vtt_text_parser.js
Expand Up @@ -401,8 +401,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 @@ -416,6 +414,8 @@ shaka.text.VttTextParser = class {
word = parser.readWord();
}

VttTextParser.parseCueStyles(payload, cue, styles);

if (id != null) {
cue.id = id;
}
Expand Down
19 changes: 17 additions & 2 deletions test/text/vtt_text_parser_unit.js
Expand Up @@ -198,15 +198,30 @@ describe('VttTextParser', () => {
{
startTime: 40,
endTime: 50,
payload: 'Test2',
payload: '',
writingMode: Cue.writingMode.VERTICAL_LEFT_TO_RIGHT,
nestedCues: [
{
startTime: 40,
endTime: 50,
payload: 'Test',
writingMode: Cue.writingMode.VERTICAL_LEFT_TO_RIGHT,
},
{
startTime: 40,
endTime: 50,
payload: '2',
fontWeight: Cue.fontWeight.BOLD,
writingMode: Cue.writingMode.VERTICAL_LEFT_TO_RIGHT,
},
],
},
],
'WEBVTT\n\n' +
'00:00:20.000 --> 00:00:40.000 vertical:rl\n' +
'Test\n\n' +
'00:00:40.000 --> 00:00:50.000 vertical:lr\n' +
'Test2',
'Test<b>2</b>',
{periodStart: 0, segmentStart: 0, segmentEnd: 0, vttOffset: 0});
});

Expand Down

0 comments on commit 8a7e32e

Please sign in to comment.