hls.js 1.6.0-rc.1.0.canary.11077 → 1.6.0-rc.1.0.canary.11079

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
@@ -1044,7 +1044,7 @@
1044
1044
  // Some browsers don't allow to use bind on console object anyway
1045
1045
  // fallback to default if needed
1046
1046
  try {
1047
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-rc.1.0.canary.11077");
1047
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-rc.1.0.canary.11079");
1048
1048
  } catch (e) {
1049
1049
  /* log fn threw an exception. All logger methods are no-ops. */
1050
1050
  return createLogger();
@@ -1809,16 +1809,27 @@
1809
1809
  }[hdlrType];
1810
1810
  if (type) {
1811
1811
  // Parse codec details
1812
- var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];
1813
- var stsdData = parseStsd(stsd);
1814
- result[trackId] = {
1815
- timescale: timescale,
1816
- type: type
1817
- };
1818
- result[type] = _objectSpread2({
1819
- timescale: timescale,
1820
- id: trackId
1821
- }, stsdData);
1812
+ var stsdBox = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];
1813
+ var stsd = parseStsd(stsdBox);
1814
+ if (type) {
1815
+ // Add 'audio', 'video', and 'audiovideo' track records that will map to SourceBuffers
1816
+ result[trackId] = {
1817
+ timescale: timescale,
1818
+ type: type,
1819
+ stsd: stsd
1820
+ };
1821
+ result[type] = _objectSpread2({
1822
+ timescale: timescale,
1823
+ id: trackId
1824
+ }, stsd);
1825
+ } else {
1826
+ // Add 'meta' and other track records required by `offsetStartDTS`
1827
+ result[trackId] = {
1828
+ timescale: timescale,
1829
+ type: hdlrType,
1830
+ stsd: stsd
1831
+ };
1832
+ }
1822
1833
  }
1823
1834
  }
1824
1835
  }
@@ -2270,6 +2281,8 @@
2270
2281
  }
2271
2282
  return duration;
2272
2283
  }
2284
+
2285
+ // TODO: Remove `offsetStartDTS` in favor of using `timestampOffset` (issue #5715)
2273
2286
  function offsetStartDTS(initData, fmp4, timeOffset) {
2274
2287
  findBox(fmp4, ['moof', 'traf']).forEach(function (traf) {
2275
2288
  findBox(traf, ['tfhd']).forEach(function (tfhd) {
@@ -18981,9 +18994,10 @@
18981
18994
  if (inLiveRange && distanceFromTarget > 0.05 && _this.forwardBufferLength > 1) {
18982
18995
  var max = Math.min(2, Math.max(1.0, maxLiveSyncPlaybackRate));
18983
18996
  var rate = Math.round(2 / (1 + Math.exp(-0.75 * distanceFromTarget - _this.edgeStalled)) * 20) / 20;
18984
- media.playbackRate = Math.min(max, Math.max(1, rate));
18997
+ var playbackRate = Math.min(max, Math.max(1, rate));
18998
+ _this.changeMediaPlaybackRate(media, playbackRate);
18985
18999
  } else if (media.playbackRate !== 1 && media.playbackRate !== 0) {
18986
- media.playbackRate = 1;
19000
+ _this.changeMediaPlaybackRate(media, 1);
18987
19001
  }
18988
19002
  };
18989
19003
  this.hls = hls;
@@ -19051,6 +19065,14 @@
19051
19065
  this.hls.logger.warn('[latency-controller]: Stall detected, adjusting target latency');
19052
19066
  }
19053
19067
  };
19068
+ _proto.changeMediaPlaybackRate = function changeMediaPlaybackRate(media, playbackRate) {
19069
+ var _this$hls, _this$targetLatency;
19070
+ if (media.playbackRate === playbackRate) {
19071
+ return;
19072
+ }
19073
+ (_this$hls = this.hls) == null ? void 0 : _this$hls.logger.debug("[latency-controller]: latency=" + this.latency.toFixed(3) + ", targetLatency=" + ((_this$targetLatency = this.targetLatency) == null ? void 0 : _this$targetLatency.toFixed(3)) + ", forwardBufferLength=" + this.forwardBufferLength.toFixed(3) + ": adjusting playback rate from " + media.playbackRate + " to " + playbackRate);
19074
+ media.playbackRate = playbackRate;
19075
+ };
19054
19076
  _proto.estimateLiveEdge = function estimateLiveEdge() {
19055
19077
  var levelDetails = this.levelDetails;
19056
19078
  if (levelDetails === null) {
@@ -19068,8 +19090,8 @@
19068
19090
  return _createClass(LatencyController, [{
19069
19091
  key: "levelDetails",
19070
19092
  get: function get() {
19071
- var _this$hls;
19072
- return ((_this$hls = this.hls) == null ? void 0 : _this$hls.latestLevelDetails) || null;
19093
+ var _this$hls2;
19094
+ return ((_this$hls2 = this.hls) == null ? void 0 : _this$hls2.latestLevelDetails) || null;
19073
19095
  }
19074
19096
  }, {
19075
19097
  key: "latency",
@@ -20240,7 +20262,7 @@
20240
20262
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
20241
20263
  }
20242
20264
 
20243
- var version = "1.6.0-rc.1.0.canary.11077";
20265
+ var version = "1.6.0-rc.1.0.canary.11079";
20244
20266
 
20245
20267
  // ensure the worker ends up in the bundle
20246
20268
  // If the worker should not be included this gets aliased to empty.js