diff --git a/lib/text/vtt_text_parser.js b/lib/text/vtt_text_parser.js index d177cb051e..44e97456e6 100644 --- a/lib/text/vtt_text_parser.js +++ b/lib/text/vtt_text_parser.js @@ -311,8 +311,8 @@ shaka.text.VttTextParser = class { return null; } - // Skip style blocks. - if (text[0] == 'STYLE') { + // Skip style and region blocks. + if (text[0] == 'STYLE' || text[0] == 'REGION') { return null; } diff --git a/test/text/vtt_text_parser_unit.js b/test/text/vtt_text_parser_unit.js index 0e17750ef8..9257a7594f 100644 --- a/test/text/vtt_text_parser_unit.js +++ b/test/text/vtt_text_parser_unit.js @@ -1064,6 +1064,22 @@ describe('VttTextParser', () => { {periodStart: 0, segmentStart: 0, segmentEnd: 0, vttOffset: 0}); }); + it('does not fail on REGION blocks', () => { + verifyHelper( + [ + { + startTime: 10, endTime: 20, + payload: 'test', + }, + ], + 'WEBVTT\n\n' + + 'REGION\n' + + 'id:1\n\n' + + '00:00:10.000 --> 00:00:20.000\n' + + 'test\n\n', + {periodStart: 0, segmentStart: 0, segmentEnd: 0, vttOffset: 0}); + }); + /** * @param {!Array} cues * @param {string} text