hls.js 1.6.0-beta.2.0.canary.10871 → 1.6.0-beta.2.0.canary.10873

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.
package/dist/hls.mjs CHANGED
@@ -401,7 +401,7 @@ function enableLogs(debugConfig, context, id) {
401
401
  // Some browsers don't allow to use bind on console object anyway
402
402
  // fallback to default if needed
403
403
  try {
404
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.10871"}`);
404
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.2.0.canary.10873"}`);
405
405
  } catch (e) {
406
406
  /* log fn threw an exception. All logger methods are no-ops. */
407
407
  return createLogger();
@@ -9847,7 +9847,7 @@ var eventemitter3 = {exports: {}};
9847
9847
  var eventemitter3Exports = eventemitter3.exports;
9848
9848
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
9849
9849
 
9850
- const version = "1.6.0-beta.2.0.canary.10871";
9850
+ const version = "1.6.0-beta.2.0.canary.10873";
9851
9851
 
9852
9852
  // ensure the worker ends up in the bundle
9853
9853
  // If the worker should not be included this gets aliased to empty.js
@@ -28828,7 +28828,6 @@ class FetchLoader {
28828
28828
  }
28829
28829
  stats.loading.start = self.performance.now();
28830
28830
  const initParams = getRequestParameters(context, this.controller.signal);
28831
- const onProgress = callbacks.onProgress;
28832
28831
  const isArrayBuffer = context.responseType === 'arraybuffer';
28833
28832
  const LENGTH = isArrayBuffer ? 'byteLength' : 'length';
28834
28833
  const {
@@ -28842,18 +28841,23 @@ class FetchLoader {
28842
28841
  self.clearTimeout(this.requestTimeout);
28843
28842
  config.timeout = maxTimeToFirstByteMs && isFiniteNumber(maxTimeToFirstByteMs) ? maxTimeToFirstByteMs : maxLoadTimeMs;
28844
28843
  this.requestTimeout = self.setTimeout(() => {
28845
- this.abortInternal();
28846
- callbacks.onTimeout(stats, context, this.response);
28844
+ if (this.callbacks) {
28845
+ this.abortInternal();
28846
+ this.callbacks.onTimeout(stats, context, this.response);
28847
+ }
28847
28848
  }, config.timeout);
28848
28849
  const fetchPromise = isPromise(this.request) ? this.request.then(self.fetch) : self.fetch(this.request);
28849
28850
  fetchPromise.then(response => {
28851
+ var _this$callbacks2;
28850
28852
  this.response = this.loader = response;
28851
28853
  const first = Math.max(self.performance.now(), stats.loading.start);
28852
28854
  self.clearTimeout(this.requestTimeout);
28853
28855
  config.timeout = maxLoadTimeMs;
28854
28856
  this.requestTimeout = self.setTimeout(() => {
28855
- this.abortInternal();
28856
- callbacks.onTimeout(stats, context, this.response);
28857
+ if (this.callbacks) {
28858
+ this.abortInternal();
28859
+ this.callbacks.onTimeout(stats, context, this.response);
28860
+ }
28857
28861
  }, maxLoadTimeMs - (first - stats.loading.start));
28858
28862
  if (!response.ok) {
28859
28863
  const {
@@ -28864,6 +28868,7 @@ class FetchLoader {
28864
28868
  }
28865
28869
  stats.loading.first = first;
28866
28870
  stats.total = getContentLength(response.headers) || stats.total;
28871
+ const onProgress = (_this$callbacks2 = this.callbacks) == null ? void 0 : _this$callbacks2.onProgress;
28867
28872
  if (onProgress && isFiniteNumber(config.highWaterMark)) {
28868
28873
  return this.loadProgressively(response, stats, context, config.highWaterMark, onProgress);
28869
28874
  }
@@ -28875,6 +28880,7 @@ class FetchLoader {
28875
28880
  }
28876
28881
  return response.text();
28877
28882
  }).then(responseData => {
28883
+ var _this$callbacks3, _this$callbacks4;
28878
28884
  const response = this.response;
28879
28885
  if (!response) {
28880
28886
  throw new Error('loader destroyed');
@@ -28890,11 +28896,13 @@ class FetchLoader {
28890
28896
  data: responseData,
28891
28897
  code: response.status
28892
28898
  };
28899
+ const onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
28893
28900
  if (onProgress && !isFiniteNumber(config.highWaterMark)) {
28894
28901
  onProgress(stats, context, responseData, response);
28895
28902
  }
28896
- callbacks.onSuccess(loaderResponse, stats, context, response);
28903
+ (_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(loaderResponse, stats, context, response);
28897
28904
  }).catch(error => {
28905
+ var _this$callbacks5;
28898
28906
  self.clearTimeout(this.requestTimeout);
28899
28907
  if (stats.aborted) {
28900
28908
  return;
@@ -28903,7 +28911,7 @@ class FetchLoader {
28903
28911
  // when destroying, 'error' itself can be undefined
28904
28912
  const code = !error ? 0 : error.code || 0;
28905
28913
  const text = !error ? null : error.message;
28906
- callbacks.onError({
28914
+ (_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
28907
28915
  code,
28908
28916
  text
28909
28917
  }, context, error ? error.details : null, stats);
@@ -29081,8 +29089,9 @@ class XhrLoader {
29081
29089
  if (this.loader !== xhr || this.stats.aborted) return;
29082
29090
  this.openAndSendXhr(xhr, context, config);
29083
29091
  }).catch(error => {
29092
+ var _this$callbacks2;
29084
29093
  // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS
29085
- this.callbacks.onError({
29094
+ (_this$callbacks2 = this.callbacks) == null ? void 0 : _this$callbacks2.onError({
29086
29095
  code: xhr.status,
29087
29096
  text: error.message
29088
29097
  }, context, xhr, stats);
@@ -29156,26 +29165,21 @@ class XhrLoader {
29156
29165
  if (status >= 200 && status < 300) {
29157
29166
  const data = useResponseText != null ? useResponseText : xhr.response;
29158
29167
  if (data != null) {
29168
+ var _this$callbacks3, _this$callbacks4;
29159
29169
  stats.loading.end = Math.max(self.performance.now(), stats.loading.first);
29160
29170
  const len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
29161
29171
  stats.loaded = stats.total = len;
29162
29172
  stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
29163
- if (!this.callbacks) {
29164
- return;
29165
- }
29166
- const onProgress = this.callbacks.onProgress;
29173
+ const onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
29167
29174
  if (onProgress) {
29168
29175
  onProgress(stats, context, data, xhr);
29169
29176
  }
29170
- if (!this.callbacks) {
29171
- return;
29172
- }
29173
29177
  const _response = {
29174
29178
  url: xhr.responseURL,
29175
29179
  data: data,
29176
29180
  code: status
29177
29181
  };
29178
- this.callbacks.onSuccess(_response, stats, context, xhr);
29182
+ (_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(_response, stats, context, xhr);
29179
29183
  return;
29180
29184
  }
29181
29185
  }
@@ -29192,8 +29196,9 @@ class XhrLoader {
29192
29196
  if (shouldRetry(retryConfig, retryCount, false, response)) {
29193
29197
  this.retry(retryConfig);
29194
29198
  } else {
29199
+ var _this$callbacks5;
29195
29200
  logger.error(`${status} while loading ${context.url}`);
29196
- this.callbacks.onError({
29201
+ (_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
29197
29202
  code: status,
29198
29203
  text: xhr.statusText
29199
29204
  }, context, xhr, stats);