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.js CHANGED
@@ -1058,7 +1058,7 @@
1058
1058
  // Some browsers don't allow to use bind on console object anyway
1059
1059
  // fallback to default if needed
1060
1060
  try {
1061
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.10871");
1061
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.10873");
1062
1062
  } catch (e) {
1063
1063
  /* log fn threw an exception. All logger methods are no-ops. */
1064
1064
  return createLogger();
@@ -16311,7 +16311,7 @@
16311
16311
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16312
16312
  }
16313
16313
 
16314
- var version = "1.6.0-beta.2.0.canary.10871";
16314
+ var version = "1.6.0-beta.2.0.canary.10873";
16315
16315
 
16316
16316
  // ensure the worker ends up in the bundle
16317
16317
  // If the worker should not be included this gets aliased to empty.js
@@ -29742,7 +29742,6 @@
29742
29742
  }
29743
29743
  stats.loading.start = self.performance.now();
29744
29744
  var initParams = getRequestParameters(context, this.controller.signal);
29745
- var onProgress = callbacks.onProgress;
29746
29745
  var isArrayBuffer = context.responseType === 'arraybuffer';
29747
29746
  var LENGTH = isArrayBuffer ? 'byteLength' : 'length';
29748
29747
  var _config$loadPolicy = config.loadPolicy,
@@ -29755,18 +29754,23 @@
29755
29754
  self.clearTimeout(this.requestTimeout);
29756
29755
  config.timeout = maxTimeToFirstByteMs && isFiniteNumber(maxTimeToFirstByteMs) ? maxTimeToFirstByteMs : maxLoadTimeMs;
29757
29756
  this.requestTimeout = self.setTimeout(function () {
29758
- _this.abortInternal();
29759
- callbacks.onTimeout(stats, context, _this.response);
29757
+ if (_this.callbacks) {
29758
+ _this.abortInternal();
29759
+ _this.callbacks.onTimeout(stats, context, _this.response);
29760
+ }
29760
29761
  }, config.timeout);
29761
29762
  var fetchPromise = isPromise(this.request) ? this.request.then(self.fetch) : self.fetch(this.request);
29762
29763
  fetchPromise.then(function (response) {
29764
+ var _this$callbacks2;
29763
29765
  _this.response = _this.loader = response;
29764
29766
  var first = Math.max(self.performance.now(), stats.loading.start);
29765
29767
  self.clearTimeout(_this.requestTimeout);
29766
29768
  config.timeout = maxLoadTimeMs;
29767
29769
  _this.requestTimeout = self.setTimeout(function () {
29768
- _this.abortInternal();
29769
- callbacks.onTimeout(stats, context, _this.response);
29770
+ if (_this.callbacks) {
29771
+ _this.abortInternal();
29772
+ _this.callbacks.onTimeout(stats, context, _this.response);
29773
+ }
29770
29774
  }, maxLoadTimeMs - (first - stats.loading.start));
29771
29775
  if (!response.ok) {
29772
29776
  var status = response.status,
@@ -29775,6 +29779,7 @@
29775
29779
  }
29776
29780
  stats.loading.first = first;
29777
29781
  stats.total = getContentLength(response.headers) || stats.total;
29782
+ var onProgress = (_this$callbacks2 = _this.callbacks) == null ? void 0 : _this$callbacks2.onProgress;
29778
29783
  if (onProgress && isFiniteNumber(config.highWaterMark)) {
29779
29784
  return _this.loadProgressively(response, stats, context, config.highWaterMark, onProgress);
29780
29785
  }
@@ -29786,6 +29791,7 @@
29786
29791
  }
29787
29792
  return response.text();
29788
29793
  }).then(function (responseData) {
29794
+ var _this$callbacks3, _this$callbacks4;
29789
29795
  var response = _this.response;
29790
29796
  if (!response) {
29791
29797
  throw new Error('loader destroyed');
@@ -29801,11 +29807,13 @@
29801
29807
  data: responseData,
29802
29808
  code: response.status
29803
29809
  };
29810
+ var onProgress = (_this$callbacks3 = _this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
29804
29811
  if (onProgress && !isFiniteNumber(config.highWaterMark)) {
29805
29812
  onProgress(stats, context, responseData, response);
29806
29813
  }
29807
- callbacks.onSuccess(loaderResponse, stats, context, response);
29814
+ (_this$callbacks4 = _this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(loaderResponse, stats, context, response);
29808
29815
  }).catch(function (error) {
29816
+ var _this$callbacks5;
29809
29817
  self.clearTimeout(_this.requestTimeout);
29810
29818
  if (stats.aborted) {
29811
29819
  return;
@@ -29814,7 +29822,7 @@
29814
29822
  // when destroying, 'error' itself can be undefined
29815
29823
  var code = !error ? 0 : error.code || 0;
29816
29824
  var text = !error ? null : error.message;
29817
- callbacks.onError({
29825
+ (_this$callbacks5 = _this.callbacks) == null ? void 0 : _this$callbacks5.onError({
29818
29826
  code: code,
29819
29827
  text: text
29820
29828
  }, context, error ? error.details : null, stats);
@@ -30000,8 +30008,9 @@
30000
30008
  if (_this.loader !== xhr || _this.stats.aborted) return;
30001
30009
  _this.openAndSendXhr(xhr, context, config);
30002
30010
  }).catch(function (error) {
30011
+ var _this$callbacks2;
30003
30012
  // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS
30004
- _this.callbacks.onError({
30013
+ (_this$callbacks2 = _this.callbacks) == null ? void 0 : _this$callbacks2.onError({
30005
30014
  code: xhr.status,
30006
30015
  text: error.message
30007
30016
  }, context, xhr, stats);
@@ -30072,26 +30081,21 @@
30072
30081
  if (_status >= 200 && _status < 300) {
30073
30082
  var data = useResponseText != null ? useResponseText : xhr.response;
30074
30083
  if (data != null) {
30084
+ var _this$callbacks3, _this$callbacks4;
30075
30085
  stats.loading.end = Math.max(self.performance.now(), stats.loading.first);
30076
30086
  var len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
30077
30087
  stats.loaded = stats.total = len;
30078
30088
  stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
30079
- if (!this.callbacks) {
30080
- return;
30081
- }
30082
- var onProgress = this.callbacks.onProgress;
30089
+ var onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
30083
30090
  if (onProgress) {
30084
30091
  onProgress(stats, context, data, xhr);
30085
30092
  }
30086
- if (!this.callbacks) {
30087
- return;
30088
- }
30089
30093
  var _response = {
30090
30094
  url: xhr.responseURL,
30091
30095
  data: data,
30092
30096
  code: _status
30093
30097
  };
30094
- this.callbacks.onSuccess(_response, stats, context, xhr);
30098
+ (_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(_response, stats, context, xhr);
30095
30099
  return;
30096
30100
  }
30097
30101
  }
@@ -30108,8 +30112,9 @@
30108
30112
  if (shouldRetry(retryConfig, retryCount, false, response)) {
30109
30113
  this.retry(retryConfig);
30110
30114
  } else {
30115
+ var _this$callbacks5;
30111
30116
  logger.error(_status + " while loading " + context.url);
30112
- this.callbacks.onError({
30117
+ (_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
30113
30118
  code: _status,
30114
30119
  text: xhr.statusText
30115
30120
  }, context, xhr, stats);