hls.js 1.5.2 → 1.5.4

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
@@ -521,7 +521,7 @@
521
521
  // Some browsers don't allow to use bind on console object anyway
522
522
  // fallback to default if needed
523
523
  try {
524
- exportedLogger.log("Debug logs enabled for \"" + id + "\" in hls.js version " + "1.5.2");
524
+ exportedLogger.log("Debug logs enabled for \"" + id + "\" in hls.js version " + "1.5.4");
525
525
  } catch (e) {
526
526
  exportedLogger = fakeLogger;
527
527
  }
@@ -1577,6 +1577,12 @@
1577
1577
  var val = readSint32(buffer, offset);
1578
1578
  return val < 0 ? 4294967296 + val : val;
1579
1579
  }
1580
+ function readUint64(buffer, offset) {
1581
+ var result = readUint32(buffer, offset);
1582
+ result *= Math.pow(2, 32);
1583
+ result += readUint32(buffer, offset + 4);
1584
+ return result;
1585
+ }
1580
1586
  function readSint32(buffer, offset) {
1581
1587
  return buffer[offset] << 24 | buffer[offset + 1] << 16 | buffer[offset + 2] << 8 | buffer[offset + 3];
1582
1588
  }
@@ -1639,15 +1645,14 @@
1639
1645
  var index = 8;
1640
1646
  var timescale = readUint32(sidx, index);
1641
1647
  index += 4;
1642
-
1643
- // TODO: parse earliestPresentationTime and firstOffset
1644
- // usually zero in our case
1645
1648
  var earliestPresentationTime = 0;
1646
1649
  var firstOffset = 0;
1647
1650
  if (version === 0) {
1648
- index += 8;
1651
+ earliestPresentationTime = readUint32(sidx, index += 4);
1652
+ firstOffset = readUint32(sidx, index += 4);
1649
1653
  } else {
1650
- index += 16;
1654
+ earliestPresentationTime = readUint64(sidx, index += 8);
1655
+ firstOffset = readUint64(sidx, index += 8);
1651
1656
  }
1652
1657
 
1653
1658
  // skip reserved
@@ -2097,17 +2102,24 @@
2097
2102
  }
2098
2103
  if (videoDuration === 0 && audioDuration === 0) {
2099
2104
  // If duration samples are not available in the traf use sidx subsegment_duration
2105
+ var sidxMinStart = Infinity;
2106
+ var sidxMaxEnd = 0;
2100
2107
  var sidxDuration = 0;
2101
2108
  var sidxs = findBox(data, ['sidx']);
2102
2109
  for (var _i2 = 0; _i2 < sidxs.length; _i2++) {
2103
2110
  var sidx = parseSegmentIndex(sidxs[_i2]);
2104
2111
  if (sidx != null && sidx.references) {
2105
- sidxDuration += sidx.references.reduce(function (dur, ref) {
2112
+ sidxMinStart = Math.min(sidxMinStart, sidx.earliestPresentationTime / sidx.timescale);
2113
+ var subSegmentDuration = sidx.references.reduce(function (dur, ref) {
2106
2114
  return dur + ref.info.duration || 0;
2107
2115
  }, 0);
2116
+ sidxMaxEnd = Math.max(sidxMaxEnd, subSegmentDuration + sidx.earliestPresentationTime / sidx.timescale);
2117
+ sidxDuration = sidxMaxEnd - sidxMinStart;
2108
2118
  }
2109
2119
  }
2110
- return sidxDuration;
2120
+ if (sidxDuration && isFiniteNumber(sidxDuration)) {
2121
+ return sidxDuration;
2122
+ }
2111
2123
  }
2112
2124
  if (videoDuration) {
2113
2125
  return videoDuration;
@@ -6859,7 +6871,7 @@
6859
6871
  var ttfbEstimateSec = this.bwEstimator.getEstimateTTFB() / 1000;
6860
6872
  var levelsSkipped = [];
6861
6873
  var _loop = function _loop() {
6862
- var _levelInfo$supportedR, _levelInfo$supportedR2;
6874
+ var _levelInfo$supportedR;
6863
6875
  var levelInfo = levels[i];
6864
6876
  var upSwitch = i > selectionBaseLevel;
6865
6877
  if (!levelInfo) {
@@ -6868,7 +6880,7 @@
6868
6880
 
6869
6881
  // skip candidates which change codec-family or video-range,
6870
6882
  // and which decrease or increase frame-rate for up and down-switch respectfully
6871
- if (currentCodecSet && levelInfo.codecSet !== currentCodecSet || currentVideoRange && levelInfo.videoRange !== currentVideoRange || upSwitch && currentFrameRate > levelInfo.frameRate || !upSwitch && currentFrameRate > 0 && currentFrameRate < levelInfo.frameRate || !((_levelInfo$supportedR = levelInfo.supportedResult) != null && (_levelInfo$supportedR2 = _levelInfo$supportedR.decodingInfoResults) != null && _levelInfo$supportedR2[0].smooth)) {
6883
+ if (currentCodecSet && levelInfo.codecSet !== currentCodecSet || currentVideoRange && levelInfo.videoRange !== currentVideoRange || upSwitch && currentFrameRate > levelInfo.frameRate || !upSwitch && currentFrameRate > 0 && currentFrameRate < levelInfo.frameRate || levelInfo.supportedResult && !((_levelInfo$supportedR = levelInfo.supportedResult.decodingInfoResults) != null && _levelInfo$supportedR[0].smooth)) {
6872
6884
  levelsSkipped.push(i);
6873
6885
  return 0; // continue
6874
6886
  }
@@ -6981,8 +6993,11 @@
6981
6993
  return nextABRAutoLevel;
6982
6994
  },
6983
6995
  set: function set(nextLevel) {
6984
- var value = Math.max(this.hls.minAutoLevel, nextLevel);
6985
- if (this._nextAutoLevel != value) {
6996
+ var _this$hls3 = this.hls,
6997
+ maxAutoLevel = _this$hls3.maxAutoLevel,
6998
+ minAutoLevel = _this$hls3.minAutoLevel;
6999
+ var value = Math.min(Math.max(nextLevel, minAutoLevel), maxAutoLevel);
7000
+ if (this._nextAutoLevel !== value) {
6986
7001
  this.nextAutoLevelKey = '';
6987
7002
  this._nextAutoLevel = value;
6988
7003
  }
@@ -19114,7 +19129,8 @@
19114
19129
  }
19115
19130
  // set new level to playlist loader : this will trigger start level load
19116
19131
  // hls.nextLoadLevel remains until it is set to a new value or until a new frag is successfully loaded
19117
- this.level = hls.nextLoadLevel = startLevel;
19132
+ hls.nextLoadLevel = startLevel;
19133
+ this.level = hls.loadLevel;
19118
19134
  this.loadedmetadata = false;
19119
19135
  }
19120
19136
  // if startPosition undefined but lastCurrentTime set, set startPosition to last currentTime
@@ -21020,7 +21036,7 @@
21020
21036
  * Get the video-dev/hls.js package version.
21021
21037
  */
21022
21038
  function get() {
21023
- return "1.5.2";
21039
+ return "1.5.4";
21024
21040
  }
21025
21041
  }, {
21026
21042
  key: "Events",