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.
@@ -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();
@@ -16766,7 +16766,6 @@ class FetchLoader {
16766
16766
  }
16767
16767
  stats.loading.start = self.performance.now();
16768
16768
  const initParams = getRequestParameters(context, this.controller.signal);
16769
- const onProgress = callbacks.onProgress;
16770
16769
  const isArrayBuffer = context.responseType === 'arraybuffer';
16771
16770
  const LENGTH = isArrayBuffer ? 'byteLength' : 'length';
16772
16771
  const {
@@ -16780,18 +16779,23 @@ class FetchLoader {
16780
16779
  self.clearTimeout(this.requestTimeout);
16781
16780
  config.timeout = maxTimeToFirstByteMs && isFiniteNumber(maxTimeToFirstByteMs) ? maxTimeToFirstByteMs : maxLoadTimeMs;
16782
16781
  this.requestTimeout = self.setTimeout(() => {
16783
- this.abortInternal();
16784
- callbacks.onTimeout(stats, context, this.response);
16782
+ if (this.callbacks) {
16783
+ this.abortInternal();
16784
+ this.callbacks.onTimeout(stats, context, this.response);
16785
+ }
16785
16786
  }, config.timeout);
16786
16787
  const fetchPromise = isPromise(this.request) ? this.request.then(self.fetch) : self.fetch(this.request);
16787
16788
  fetchPromise.then(response => {
16789
+ var _this$callbacks2;
16788
16790
  this.response = this.loader = response;
16789
16791
  const first = Math.max(self.performance.now(), stats.loading.start);
16790
16792
  self.clearTimeout(this.requestTimeout);
16791
16793
  config.timeout = maxLoadTimeMs;
16792
16794
  this.requestTimeout = self.setTimeout(() => {
16793
- this.abortInternal();
16794
- callbacks.onTimeout(stats, context, this.response);
16795
+ if (this.callbacks) {
16796
+ this.abortInternal();
16797
+ this.callbacks.onTimeout(stats, context, this.response);
16798
+ }
16795
16799
  }, maxLoadTimeMs - (first - stats.loading.start));
16796
16800
  if (!response.ok) {
16797
16801
  const {
@@ -16802,6 +16806,7 @@ class FetchLoader {
16802
16806
  }
16803
16807
  stats.loading.first = first;
16804
16808
  stats.total = getContentLength(response.headers) || stats.total;
16809
+ const onProgress = (_this$callbacks2 = this.callbacks) == null ? void 0 : _this$callbacks2.onProgress;
16805
16810
  if (onProgress && isFiniteNumber(config.highWaterMark)) {
16806
16811
  return this.loadProgressively(response, stats, context, config.highWaterMark, onProgress);
16807
16812
  }
@@ -16813,6 +16818,7 @@ class FetchLoader {
16813
16818
  }
16814
16819
  return response.text();
16815
16820
  }).then(responseData => {
16821
+ var _this$callbacks3, _this$callbacks4;
16816
16822
  const response = this.response;
16817
16823
  if (!response) {
16818
16824
  throw new Error('loader destroyed');
@@ -16828,11 +16834,13 @@ class FetchLoader {
16828
16834
  data: responseData,
16829
16835
  code: response.status
16830
16836
  };
16837
+ const onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
16831
16838
  if (onProgress && !isFiniteNumber(config.highWaterMark)) {
16832
16839
  onProgress(stats, context, responseData, response);
16833
16840
  }
16834
- callbacks.onSuccess(loaderResponse, stats, context, response);
16841
+ (_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(loaderResponse, stats, context, response);
16835
16842
  }).catch(error => {
16843
+ var _this$callbacks5;
16836
16844
  self.clearTimeout(this.requestTimeout);
16837
16845
  if (stats.aborted) {
16838
16846
  return;
@@ -16841,7 +16849,7 @@ class FetchLoader {
16841
16849
  // when destroying, 'error' itself can be undefined
16842
16850
  const code = !error ? 0 : error.code || 0;
16843
16851
  const text = !error ? null : error.message;
16844
- callbacks.onError({
16852
+ (_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
16845
16853
  code,
16846
16854
  text
16847
16855
  }, context, error ? error.details : null, stats);
@@ -17019,8 +17027,9 @@ class XhrLoader {
17019
17027
  if (this.loader !== xhr || this.stats.aborted) return;
17020
17028
  this.openAndSendXhr(xhr, context, config);
17021
17029
  }).catch(error => {
17030
+ var _this$callbacks2;
17022
17031
  // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS
17023
- this.callbacks.onError({
17032
+ (_this$callbacks2 = this.callbacks) == null ? void 0 : _this$callbacks2.onError({
17024
17033
  code: xhr.status,
17025
17034
  text: error.message
17026
17035
  }, context, xhr, stats);
@@ -17094,26 +17103,21 @@ class XhrLoader {
17094
17103
  if (status >= 200 && status < 300) {
17095
17104
  const data = useResponseText != null ? useResponseText : xhr.response;
17096
17105
  if (data != null) {
17106
+ var _this$callbacks3, _this$callbacks4;
17097
17107
  stats.loading.end = Math.max(self.performance.now(), stats.loading.first);
17098
17108
  const len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
17099
17109
  stats.loaded = stats.total = len;
17100
17110
  stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
17101
- if (!this.callbacks) {
17102
- return;
17103
- }
17104
- const onProgress = this.callbacks.onProgress;
17111
+ const onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
17105
17112
  if (onProgress) {
17106
17113
  onProgress(stats, context, data, xhr);
17107
17114
  }
17108
- if (!this.callbacks) {
17109
- return;
17110
- }
17111
17115
  const _response = {
17112
17116
  url: xhr.responseURL,
17113
17117
  data: data,
17114
17118
  code: status
17115
17119
  };
17116
- this.callbacks.onSuccess(_response, stats, context, xhr);
17120
+ (_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(_response, stats, context, xhr);
17117
17121
  return;
17118
17122
  }
17119
17123
  }
@@ -17130,8 +17134,9 @@ class XhrLoader {
17130
17134
  if (shouldRetry(retryConfig, retryCount, false, response)) {
17131
17135
  this.retry(retryConfig);
17132
17136
  } else {
17137
+ var _this$callbacks5;
17133
17138
  logger.error(`${status} while loading ${context.url}`);
17134
- this.callbacks.onError({
17139
+ (_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
17135
17140
  code: status,
17136
17141
  text: xhr.statusText
17137
17142
  }, context, xhr, stats);
@@ -19179,7 +19184,7 @@ class GapController extends Logger {
19179
19184
  }
19180
19185
  }
19181
19186
 
19182
- const version = "1.6.0-beta.2.0.canary.10871";
19187
+ const version = "1.6.0-beta.2.0.canary.10873";
19183
19188
 
19184
19189
  // ensure the worker ends up in the bundle
19185
19190
  // If the worker should not be included this gets aliased to empty.js