hls.js 1.6.0-beta.2.0.canary.10869 → 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.10869");
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();
@@ -12606,8 +12606,10 @@
12606
12606
  case 32:
12607
12607
  push = true;
12608
12608
  if (!track.vps) {
12609
- var config = _this2.readVPS(unit.data);
12610
- track.params = _objectSpread2({}, config);
12609
+ if (typeof track.params !== 'object') {
12610
+ track.params = {};
12611
+ }
12612
+ track.params = _extends(track.params, _this2.readVPS(unit.data));
12611
12613
  _this2.initVPS = unit.data;
12612
12614
  }
12613
12615
  track.vps = [unit.data];
@@ -12617,26 +12619,27 @@
12617
12619
  case 33:
12618
12620
  push = true;
12619
12621
  spsfound = true;
12620
- if (typeof track.params === 'object') {
12621
- if (track.vps !== undefined && track.vps[0] !== _this2.initVPS && track.sps !== undefined && !_this2.matchSPS(track.sps[0], unit.data)) {
12622
- _this2.initVPS = track.vps[0];
12623
- track.sps = track.pps = undefined;
12624
- }
12625
- if (!track.sps) {
12626
- var _config = _this2.readSPS(unit.data);
12627
- track.width = _config.width;
12628
- track.height = _config.height;
12629
- track.pixelRatio = _config.pixelRatio;
12630
- track.codec = _config.codecString;
12631
- track.sps = [];
12632
- for (var prop in _config.params) {
12633
- track.params[prop] = _config.params[prop];
12634
- }
12622
+ if (track.vps !== undefined && track.vps[0] !== _this2.initVPS && track.sps !== undefined && !_this2.matchSPS(track.sps[0], unit.data)) {
12623
+ _this2.initVPS = track.vps[0];
12624
+ track.sps = track.pps = undefined;
12625
+ }
12626
+ if (!track.sps) {
12627
+ var config = _this2.readSPS(unit.data);
12628
+ track.width = config.width;
12629
+ track.height = config.height;
12630
+ track.pixelRatio = config.pixelRatio;
12631
+ track.codec = config.codecString;
12632
+ track.sps = [];
12633
+ if (typeof track.params !== 'object') {
12634
+ track.params = {};
12635
12635
  }
12636
- if (track.vps !== undefined && track.vps[0] === _this2.initVPS) {
12637
- track.sps.push(unit.data);
12636
+ for (var prop in config.params) {
12637
+ track.params[prop] = config.params[prop];
12638
12638
  }
12639
12639
  }
12640
+ if (!track.vps && !track.sps.length || track.vps && track.vps[0] === _this2.initVPS) {
12641
+ track.sps.push(unit.data);
12642
+ }
12640
12643
  if (!VideoSample) {
12641
12644
  VideoSample = _this2.VideoSample = _this2.createVideoSample(true, pes.pts, pes.dts);
12642
12645
  }
@@ -12649,12 +12652,12 @@
12649
12652
  if (typeof track.params === 'object') {
12650
12653
  if (!track.pps) {
12651
12654
  track.pps = [];
12652
- var _config2 = _this2.readPPS(unit.data);
12653
- for (var _prop in _config2) {
12654
- track.params[_prop] = _config2[_prop];
12655
+ var _config = _this2.readPPS(unit.data);
12656
+ for (var _prop in _config) {
12657
+ track.params[_prop] = _config[_prop];
12655
12658
  }
12656
12659
  }
12657
- if (track.vps !== undefined && track.vps[0] === _this2.initVPS) {
12660
+ if (!track.vps && !track.pps.length || track.vps && track.vps[0] === _this2.initVPS) {
12658
12661
  track.pps.push(unit.data);
12659
12662
  }
12660
12663
  }
@@ -16308,7 +16311,7 @@
16308
16311
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16309
16312
  }
16310
16313
 
16311
- var version = "1.6.0-beta.2.0.canary.10869";
16314
+ var version = "1.6.0-beta.2.0.canary.10873";
16312
16315
 
16313
16316
  // ensure the worker ends up in the bundle
16314
16317
  // If the worker should not be included this gets aliased to empty.js
@@ -29739,7 +29742,6 @@
29739
29742
  }
29740
29743
  stats.loading.start = self.performance.now();
29741
29744
  var initParams = getRequestParameters(context, this.controller.signal);
29742
- var onProgress = callbacks.onProgress;
29743
29745
  var isArrayBuffer = context.responseType === 'arraybuffer';
29744
29746
  var LENGTH = isArrayBuffer ? 'byteLength' : 'length';
29745
29747
  var _config$loadPolicy = config.loadPolicy,
@@ -29752,18 +29754,23 @@
29752
29754
  self.clearTimeout(this.requestTimeout);
29753
29755
  config.timeout = maxTimeToFirstByteMs && isFiniteNumber(maxTimeToFirstByteMs) ? maxTimeToFirstByteMs : maxLoadTimeMs;
29754
29756
  this.requestTimeout = self.setTimeout(function () {
29755
- _this.abortInternal();
29756
- callbacks.onTimeout(stats, context, _this.response);
29757
+ if (_this.callbacks) {
29758
+ _this.abortInternal();
29759
+ _this.callbacks.onTimeout(stats, context, _this.response);
29760
+ }
29757
29761
  }, config.timeout);
29758
29762
  var fetchPromise = isPromise(this.request) ? this.request.then(self.fetch) : self.fetch(this.request);
29759
29763
  fetchPromise.then(function (response) {
29764
+ var _this$callbacks2;
29760
29765
  _this.response = _this.loader = response;
29761
29766
  var first = Math.max(self.performance.now(), stats.loading.start);
29762
29767
  self.clearTimeout(_this.requestTimeout);
29763
29768
  config.timeout = maxLoadTimeMs;
29764
29769
  _this.requestTimeout = self.setTimeout(function () {
29765
- _this.abortInternal();
29766
- callbacks.onTimeout(stats, context, _this.response);
29770
+ if (_this.callbacks) {
29771
+ _this.abortInternal();
29772
+ _this.callbacks.onTimeout(stats, context, _this.response);
29773
+ }
29767
29774
  }, maxLoadTimeMs - (first - stats.loading.start));
29768
29775
  if (!response.ok) {
29769
29776
  var status = response.status,
@@ -29772,6 +29779,7 @@
29772
29779
  }
29773
29780
  stats.loading.first = first;
29774
29781
  stats.total = getContentLength(response.headers) || stats.total;
29782
+ var onProgress = (_this$callbacks2 = _this.callbacks) == null ? void 0 : _this$callbacks2.onProgress;
29775
29783
  if (onProgress && isFiniteNumber(config.highWaterMark)) {
29776
29784
  return _this.loadProgressively(response, stats, context, config.highWaterMark, onProgress);
29777
29785
  }
@@ -29783,6 +29791,7 @@
29783
29791
  }
29784
29792
  return response.text();
29785
29793
  }).then(function (responseData) {
29794
+ var _this$callbacks3, _this$callbacks4;
29786
29795
  var response = _this.response;
29787
29796
  if (!response) {
29788
29797
  throw new Error('loader destroyed');
@@ -29798,11 +29807,13 @@
29798
29807
  data: responseData,
29799
29808
  code: response.status
29800
29809
  };
29810
+ var onProgress = (_this$callbacks3 = _this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
29801
29811
  if (onProgress && !isFiniteNumber(config.highWaterMark)) {
29802
29812
  onProgress(stats, context, responseData, response);
29803
29813
  }
29804
- callbacks.onSuccess(loaderResponse, stats, context, response);
29814
+ (_this$callbacks4 = _this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(loaderResponse, stats, context, response);
29805
29815
  }).catch(function (error) {
29816
+ var _this$callbacks5;
29806
29817
  self.clearTimeout(_this.requestTimeout);
29807
29818
  if (stats.aborted) {
29808
29819
  return;
@@ -29811,7 +29822,7 @@
29811
29822
  // when destroying, 'error' itself can be undefined
29812
29823
  var code = !error ? 0 : error.code || 0;
29813
29824
  var text = !error ? null : error.message;
29814
- callbacks.onError({
29825
+ (_this$callbacks5 = _this.callbacks) == null ? void 0 : _this$callbacks5.onError({
29815
29826
  code: code,
29816
29827
  text: text
29817
29828
  }, context, error ? error.details : null, stats);
@@ -29997,8 +30008,9 @@
29997
30008
  if (_this.loader !== xhr || _this.stats.aborted) return;
29998
30009
  _this.openAndSendXhr(xhr, context, config);
29999
30010
  }).catch(function (error) {
30011
+ var _this$callbacks2;
30000
30012
  // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS
30001
- _this.callbacks.onError({
30013
+ (_this$callbacks2 = _this.callbacks) == null ? void 0 : _this$callbacks2.onError({
30002
30014
  code: xhr.status,
30003
30015
  text: error.message
30004
30016
  }, context, xhr, stats);
@@ -30069,26 +30081,21 @@
30069
30081
  if (_status >= 200 && _status < 300) {
30070
30082
  var data = useResponseText != null ? useResponseText : xhr.response;
30071
30083
  if (data != null) {
30084
+ var _this$callbacks3, _this$callbacks4;
30072
30085
  stats.loading.end = Math.max(self.performance.now(), stats.loading.first);
30073
30086
  var len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;
30074
30087
  stats.loaded = stats.total = len;
30075
30088
  stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);
30076
- if (!this.callbacks) {
30077
- return;
30078
- }
30079
- var onProgress = this.callbacks.onProgress;
30089
+ var onProgress = (_this$callbacks3 = this.callbacks) == null ? void 0 : _this$callbacks3.onProgress;
30080
30090
  if (onProgress) {
30081
30091
  onProgress(stats, context, data, xhr);
30082
30092
  }
30083
- if (!this.callbacks) {
30084
- return;
30085
- }
30086
30093
  var _response = {
30087
30094
  url: xhr.responseURL,
30088
30095
  data: data,
30089
30096
  code: _status
30090
30097
  };
30091
- this.callbacks.onSuccess(_response, stats, context, xhr);
30098
+ (_this$callbacks4 = this.callbacks) == null ? void 0 : _this$callbacks4.onSuccess(_response, stats, context, xhr);
30092
30099
  return;
30093
30100
  }
30094
30101
  }
@@ -30105,8 +30112,9 @@
30105
30112
  if (shouldRetry(retryConfig, retryCount, false, response)) {
30106
30113
  this.retry(retryConfig);
30107
30114
  } else {
30115
+ var _this$callbacks5;
30108
30116
  logger.error(_status + " while loading " + context.url);
30109
- this.callbacks.onError({
30117
+ (_this$callbacks5 = this.callbacks) == null ? void 0 : _this$callbacks5.onError({
30110
30118
  code: _status,
30111
30119
  text: xhr.statusText
30112
30120
  }, context, xhr, stats);