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.js CHANGED
@@ -1073,7 +1073,7 @@
1073
1073
  // Some browsers don't allow to use bind on console object anyway
1074
1074
  // fallback to default if needed
1075
1075
  try {
1076
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-rc.1.0.canary.11077");
1076
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-rc.1.0.canary.11079");
1077
1077
  } catch (e) {
1078
1078
  /* log fn threw an exception. All logger methods are no-ops. */
1079
1079
  return createLogger();
@@ -1845,16 +1845,27 @@
1845
1845
  }[hdlrType];
1846
1846
  if (type) {
1847
1847
  // Parse codec details
1848
- var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];
1849
- var stsdData = parseStsd(stsd);
1850
- result[trackId] = {
1851
- timescale: timescale,
1852
- type: type
1853
- };
1854
- result[type] = _objectSpread2({
1855
- timescale: timescale,
1856
- id: trackId
1857
- }, stsdData);
1848
+ var stsdBox = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];
1849
+ var stsd = parseStsd(stsdBox);
1850
+ if (type) {
1851
+ // Add 'audio', 'video', and 'audiovideo' track records that will map to SourceBuffers
1852
+ result[trackId] = {
1853
+ timescale: timescale,
1854
+ type: type,
1855
+ stsd: stsd
1856
+ };
1857
+ result[type] = _objectSpread2({
1858
+ timescale: timescale,
1859
+ id: trackId
1860
+ }, stsd);
1861
+ } else {
1862
+ // Add 'meta' and other track records required by `offsetStartDTS`
1863
+ result[trackId] = {
1864
+ timescale: timescale,
1865
+ type: hdlrType,
1866
+ stsd: stsd
1867
+ };
1868
+ }
1858
1869
  }
1859
1870
  }
1860
1871
  }
@@ -2306,6 +2317,8 @@
2306
2317
  }
2307
2318
  return duration;
2308
2319
  }
2320
+
2321
+ // TODO: Remove `offsetStartDTS` in favor of using `timestampOffset` (issue #5715)
2309
2322
  function offsetStartDTS(initData, fmp4, timeOffset) {
2310
2323
  findBox(fmp4, ['moof', 'traf']).forEach(function (traf) {
2311
2324
  findBox(traf, ['tfhd']).forEach(function (tfhd) {
@@ -16547,7 +16560,7 @@
16547
16560
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16548
16561
  }
16549
16562
 
16550
- var version = "1.6.0-rc.1.0.canary.11077";
16563
+ var version = "1.6.0-rc.1.0.canary.11079";
16551
16564
 
16552
16565
  // ensure the worker ends up in the bundle
16553
16566
  // If the worker should not be included this gets aliased to empty.js
@@ -31975,9 +31988,10 @@
31975
31988
  if (inLiveRange && distanceFromTarget > 0.05 && _this.forwardBufferLength > 1) {
31976
31989
  var max = Math.min(2, Math.max(1.0, maxLiveSyncPlaybackRate));
31977
31990
  var rate = Math.round(2 / (1 + Math.exp(-0.75 * distanceFromTarget - _this.edgeStalled)) * 20) / 20;
31978
- media.playbackRate = Math.min(max, Math.max(1, rate));
31991
+ var playbackRate = Math.min(max, Math.max(1, rate));
31992
+ _this.changeMediaPlaybackRate(media, playbackRate);
31979
31993
  } else if (media.playbackRate !== 1 && media.playbackRate !== 0) {
31980
- media.playbackRate = 1;
31994
+ _this.changeMediaPlaybackRate(media, 1);
31981
31995
  }
31982
31996
  };
31983
31997
  this.hls = hls;
@@ -32045,6 +32059,14 @@
32045
32059
  this.hls.logger.warn('[latency-controller]: Stall detected, adjusting target latency');
32046
32060
  }
32047
32061
  };
32062
+ _proto.changeMediaPlaybackRate = function changeMediaPlaybackRate(media, playbackRate) {
32063
+ var _this$hls, _this$targetLatency;
32064
+ if (media.playbackRate === playbackRate) {
32065
+ return;
32066
+ }
32067
+ (_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);
32068
+ media.playbackRate = playbackRate;
32069
+ };
32048
32070
  _proto.estimateLiveEdge = function estimateLiveEdge() {
32049
32071
  var levelDetails = this.levelDetails;
32050
32072
  if (levelDetails === null) {
@@ -32062,8 +32084,8 @@
32062
32084
  return _createClass(LatencyController, [{
32063
32085
  key: "levelDetails",
32064
32086
  get: function get() {
32065
- var _this$hls;
32066
- return ((_this$hls = this.hls) == null ? void 0 : _this$hls.latestLevelDetails) || null;
32087
+ var _this$hls2;
32088
+ return ((_this$hls2 = this.hls) == null ? void 0 : _this$hls2.latestLevelDetails) || null;
32067
32089
  }
32068
32090
  }, {
32069
32091
  key: "latency",