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.light.js CHANGED
@@ -1029,7 +1029,7 @@
1029
1029
  // Some browsers don't allow to use bind on console object anyway
1030
1030
  // fallback to default if needed
1031
1031
  try {
1032
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.10871");
1032
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.2.0.canary.10873");
1033
1033
  } catch (e) {
1034
1034
  /* log fn threw an exception. All logger methods are no-ops. */
1035
1035
  return createLogger();
@@ -14454,7 +14454,6 @@
14454
14454
  }
14455
14455
  stats.loading.start = self.performance.now();
14456
14456
  var initParams = getRequestParameters(context, this.controller.signal);
14457
- var onProgress = callbacks.onProgress;
14458
14457
  var isArrayBuffer = context.responseType === 'arraybuffer';
14459
14458
  var LENGTH = isArrayBuffer ? 'byteLength' : 'length';
14460
14459
  var _config$loadPolicy = config.loadPolicy,
@@ -14467,18 +14466,23 @@
14467
14466
  self.clearTimeout(this.requestTimeout);
14468
14467
  config.timeout = maxTimeToFirstByteMs && isFiniteNumber(maxTimeToFirstByteMs) ? maxTimeToFirstByteMs : maxLoadTimeMs;
14469
14468
  this.requestTimeout = self.setTimeout(function () {
14470
- _this.abortInternal();
14471
- callbacks.onTimeout(stats, context, _this.response);
14469
+ if (_this.callbacks) {
14470
+ _this.abortInternal();
14471
+ _this.callbacks.onTimeout(stats, context, _this.response);
14472
+ }
14472
14473
  }, config.timeout);
14473
14474
  var fetchPromise = isPromise(this.request) ? this.request.then(self.fetch) : self.fetch(this.request);
14474
14475
  fetchPromise.then(function (response) {
14476
+ var _this$callbacks2;
14475
14477
  _this.response = _this.loader = response;
14476
14478
  var first = Math.max(self.performance.now(), stats.loading.start);
14477
14479
  self.clearTimeout(_this.requestTimeout);
14478
14480
  config.timeout = maxLoadTimeMs;
14479
14481
  _this.requestTimeout = self.setTimeout(function () {
14480
- _this.abortInternal();
14481
- callbacks.onTimeout(stats, context, _this.response);
14482
+ if (_this.callbacks) {
14483
+ _this.abortInternal();
14484
+ _this.callbacks.onTimeout(stats, context, _this.response);
14485
+ }
14482
14486
  }, maxLoadTimeMs - (first - stats.loading.start));
14483
14487
  if (!response.ok) {
14484
14488
  var status = response.status,
@@ -14487,6 +14491,7 @@
14487
14491
  }
14488
14492
  stats.loading.first = first;
14489
14493
  stats.total = getContentLength(response.headers) || stats.total;
14494
+ var onProgress = (_this$callbacks2 = _this.callbacks) == null ? void 0 : _this$callbacks2.onProgress;
14490
14495
  if (onProgress && isFiniteNumber(config.highWaterMark)) {
14491
14496
  return _this.loadProgressively(response, stats, context, config.highWaterMark, onProgress);
14492
14497
  }
@@ -14498,6 +14503,7 @@
14498
14503
  }
14499
14504
  return response.text();
14500
14505
  }).then(function (responseData) {
14506
+ var _this$callbacks3, _this$callbacks4;
14501
14507
  var response = _this.response;
14502
14508
  if (!response) {
14503
14509
  throw new Error('loader destroyed');
@@ -14513,11 +14519,13 @@
14513
14519
  data: responseData,
14514
14520
  code: response.status
14515
14521
  };
14522
+ var onProgress = (_this$callbacks3 = _this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
14516
14523
  if (onProgress && !isFiniteNumber(config.highWaterMark)) {
14517
14524
  onProgress(stats, context, responseData, response);
14518
14525
  }
14519
- callbacks.onSuccess(loaderResponse, stats, context, response);
14526
+ (_this$callbacks4 = _this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(loaderResponse, stats, context, response);
14520
14527
  }).catch(function (error) {
14528
+ var _this$callbacks5;
14521
14529
  self.clearTimeout(_this.requestTimeout);
14522
14530
  if (stats.aborted) {
14523
14531
  return;
@@ -14526,7 +14534,7 @@
14526
14534
  // when destroying, 'error' itself can be undefined
14527
14535
  var code = !error ? 0 : error.code || 0;
14528
14536
  var text = !error ? null : error.message;
14529
- callbacks.onError({
14537
+ (_this$callbacks5 = _this.callbacks) == null ? void 0 : _this$callbacks5.onError({
14530
14538
  code: code,
14531
14539
  text: text
14532
14540
  }, context, error ? error.details : null, stats);
@@ -14712,8 +14720,9 @@
14712
14720
  if (_this.loader !== xhr || _this.stats.aborted) return;
14713
14721
  _this.openAndSendXhr(xhr, context, config);
14714
14722
  }).catch(function (error) {
14723
+ var _this$callbacks2;
14715
14724
  // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS
14716
- _this.callbacks.onError({
14725
+ (_this$callbacks2 = _this.callbacks) == null ? void 0 : _this$callbacks2.onError({
14717
14726
  code: xhr.status,
14718
14727
  text: error.message
14719
14728
  }, context, xhr, stats);
@@ -14784,26 +14793,21 @@
14784
14793
  if (_status >= 200 && _status < 300) {
14785
14794
  var data = useResponseText != null ? useResponseText : xhr.response;
14786
14795
  if (data != null) {
14796
+ var _this$callbacks3, _this$callbacks4;
14787
14797
  stats.loading.end = Math.max(self.performance.now(), stats.loading.first);
14788
14798
  var len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
14789
14799
  stats.loaded = stats.total = len;
14790
14800
  stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
14791
- if (!this.callbacks) {
14792
- return;
14793
- }
14794
- var onProgress = this.callbacks.onProgress;
14801
+ var onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
14795
14802
  if (onProgress) {
14796
14803
  onProgress(stats, context, data, xhr);
14797
14804
  }
14798
- if (!this.callbacks) {
14799
- return;
14800
- }
14801
14805
  var _response = {
14802
14806
  url: xhr.responseURL,
14803
14807
  data: data,
14804
14808
  code: _status
14805
14809
  };
14806
- this.callbacks.onSuccess(_response, stats, context, xhr);
14810
+ (_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(_response, stats, context, xhr);
14807
14811
  return;
14808
14812
  }
14809
14813
  }
@@ -14820,8 +14824,9 @@
14820
14824
  if (shouldRetry(retryConfig, retryCount, false, response)) {
14821
14825
  this.retry(retryConfig);
14822
14826
  } else {
14827
+ var _this$callbacks5;
14823
14828
  logger.error(_status + " while loading " + context.url);
14824
- this.callbacks.onError({
14829
+ (_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
14825
14830
  code: _status,
14826
14831
  text: xhr.statusText
14827
14832
  }, context, xhr, stats);
@@ -19801,7 +19806,7 @@
19801
19806
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
19802
19807
  }
19803
19808
 
19804
- var version = "1.6.0-beta.2.0.canary.10871";
19809
+ var version = "1.6.0-beta.2.0.canary.10873";
19805
19810
 
19806
19811
  // ensure the worker ends up in the bundle
19807
19812
  // If the worker should not be included this gets aliased to empty.js