Skip to content

Commit cf7739b

Browse files
authored
allow ":" or "=" inside metadata value
1 parent 95eea28 commit cf7739b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/vtt/vtt-parser.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,13 @@ export class VTTParser implements CaptionsParser {
115115
protected _parseHeader(line: string, lineCount: number) {
116116
if (lineCount > 1) {
117117
if (SETTING_SEP_RE.test(line)) {
118-
const [key, value] = line.split(SETTING_SEP_RE);
119-
if (key) this._metadata[key] = (value || '').replace(SPACE_RE, '');
118+
const separatorIndex = line.indexOf(SETTING_SEP_RE);
119+
if (separatorIndex !== -1) {
120+
const key = line.substring(0, separatorIndex);
121+
const value = line.substring(separatorIndex + SETTING_SEP_RE.length);
122+
this._metadata[key] = (value || '').trim()
123+
}
124+
if (key)
120125
}
121126
} else if (line.startsWith(HEADER_MAGIC)) {
122127
this._block = VTTBlock.Header;

0 commit comments

Comments
 (0)