hls.js 1.4.6 → 1.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -92,7 +92,7 @@ const calculateOffset = function (vttCCs: VTTCCs, cc, presentationTime) {
92
92
 
93
93
  export function parseWebVTT(
94
94
  vttByteArray: ArrayBuffer,
95
- initPTS: RationalTimestamp,
95
+ initPTS: RationalTimestamp | undefined,
96
96
  vttCCs: VTTCCs,
97
97
  cc: number,
98
98
  timeOffset: number,
@@ -107,10 +107,9 @@ export function parseWebVTT(
107
107
  .replace(LINEBREAKS, '\n')
108
108
  .split('\n');
109
109
  const cues: VTTCue[] = [];
110
- const init90kHz = toMpegTsClockFromTimescale(
111
- initPTS.baseTime,
112
- initPTS.timescale
113
- );
110
+ const init90kHz = initPTS
111
+ ? toMpegTsClockFromTimescale(initPTS.baseTime, initPTS.timescale)
112
+ : 0;
114
113
  let cueTime = '00:00.000';
115
114
  let timestampMapMPEGTS = 0;
116
115
  let timestampMapLOCAL = 0;
@@ -134,8 +133,11 @@ export function parseWebVTT(
134
133
  calculateOffset(vttCCs, cc, webVttMpegTsMapOffset);
135
134
  }
136
135
  }
137
-
138
136
  if (webVttMpegTsMapOffset) {
137
+ if (!initPTS) {
138
+ parsingError = new Error('Missing initPTS for VTT MPEGTS');
139
+ return;
140
+ }
139
141
  // If we have MPEGTS, offset = presentation time + discontinuity offset
140
142
  cueOffset = webVttMpegTsMapOffset - vttCCs.presentationOffset;
141
143
  }
@@ -86,6 +86,7 @@ class XhrLoader implements Loader<LoaderContext> {
86
86
  const stats = this.stats;
87
87
  stats.loading.first = 0;
88
88
  stats.loaded = 0;
89
+ stats.aborted = false;
89
90
  const xhrSetup = this.xhrSetup;
90
91
 
91
92
  if (xhrSetup) {