File tree 1 file changed +23
-7
lines changed
1 file changed +23
-7
lines changed Original file line number Diff line number Diff line change 64
64
err ( "No valid signature. (File needs to start with \"WEBVTT\".)" )
65
65
}
66
66
67
- linePos ++
68
-
69
- /* HEADER */
70
- while ( lines [ linePos ] != "" && lines [ linePos ] != undefined ) {
71
- err ( "No blank line after the signature." )
72
- if ( lines [ linePos ] . indexOf ( "-->" ) != - 1 ) {
73
- alreadyCollected = true
67
+ /* HEADER */
68
+ while ( lines [ linePos ] !== undefined ) {
69
+ line = lines [ linePos ]
70
+ /* look-ahead */
71
+ if ( line === "" ) {
72
+ if ( ( lines [ linePos + 1 ] && lines [ linePos + 1 ] . indexOf ( "-->" ) !== - 1 ) ||
73
+ ( lines [ linePos + 2 ] && lines [ linePos + 2 ] . indexOf ( "-->" ) !== - 1 ) ) {
74
74
break
75
+ } else {
76
+ linePos ++
77
+ continue
78
+ }
79
+ } else {
80
+ if ( ( line . match ( / : / g) || [ ] ) . length !== 1 ) {
81
+ err ( "Metadata header line needs to consist of a name and value separated by a ':' character." )
82
+ if ( line . indexOf ( "-->" ) != - 1 ) {
83
+ err ( "Cues need to be separated from the Header by a blank line." )
84
+ alreadyCollected = true
85
+ }
86
+ }
87
+ if ( line . substring ( 0 , 6 ) !== "Region" ) {
88
+ err ( "Metadata headers other than Region are not defined." )
89
+ alreadyCollected = true
75
90
}
76
91
linePos ++
77
92
}
93
+ }
78
94
79
95
/* CUE LOOP */
80
96
while ( lines [ linePos ] != undefined ) {
You can’t perform that action at this time.
0 commit comments