hls.js 1.6.7-0.canary.11368 → 1.6.7-0.canary.11369

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
@@ -1165,7 +1165,7 @@
1165
1165
  // Some browsers don't allow to use bind on console object anyway
1166
1166
  // fallback to default if needed
1167
1167
  try {
1168
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.7-0.canary.11368");
1168
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.7-0.canary.11369");
1169
1169
  } catch (e) {
1170
1170
  /* log fn threw an exception. All logger methods are no-ops. */
1171
1171
  return createLogger();
@@ -1312,6 +1312,9 @@
1312
1312
  return str;
1313
1313
  }
1314
1314
  };
1315
+ function hexToArrayBuffer(str) {
1316
+ return Uint8Array.from(str.replace(/^0x/, '').replace(/([\da-fA-F]{2}) ?/g, '0x$1 ').replace(/ +$/, '').split(' ')).buffer;
1317
+ }
1315
1318
 
1316
1319
  var LoadStats = function LoadStats() {
1317
1320
  this.aborted = false;
@@ -7418,7 +7421,7 @@
7418
7421
  }
7419
7422
 
7420
7423
  var LevelKey = /*#__PURE__*/function () {
7421
- function LevelKey(method, uri, format, formatversions, iv) {
7424
+ function LevelKey(method, uri, format, formatversions, iv, keyId) {
7422
7425
  if (formatversions === void 0) {
7423
7426
  formatversions = [1];
7424
7427
  }
@@ -7442,10 +7445,17 @@
7442
7445
  this.iv = iv;
7443
7446
  this.encrypted = method ? method !== 'NONE' : false;
7444
7447
  this.isCommonEncryption = this.encrypted && !isFullSegmentEncryption(method);
7448
+ if (keyId != null && keyId.startsWith('0x')) {
7449
+ this.keyId = new Uint8Array(hexToArrayBuffer(keyId));
7450
+ }
7445
7451
  }
7446
7452
  LevelKey.clearKeyUriToKeyIdMap = function clearKeyUriToKeyIdMap() {
7447
7453
  };
7448
7454
  var _proto = LevelKey.prototype;
7455
+ _proto.matches = function matches(key) {
7456
+ var _key$iv, _this$iv;
7457
+ return key.uri === this.uri && key.method === this.method && key.encrypted === this.encrypted && key.keyFormat === this.keyFormat && key.keyFormatVersions.join(',') === this.keyFormatVersions.join(',') && ((_key$iv = key.iv) == null ? void 0 : _key$iv.join(',')) === ((_this$iv = this.iv) == null ? void 0 : _this$iv.join(','));
7458
+ };
7449
7459
  _proto.isSupported = function isSupported() {
7450
7460
  // If it's Segment encryption or No encryption, just select that key system
7451
7461
  if (this.method) {
@@ -7927,10 +7937,14 @@
7927
7937
  if (!levelkeys) {
7928
7938
  levelkeys = {};
7929
7939
  }
7930
- if (levelkeys[levelKey.keyFormat]) {
7931
- levelkeys = _extends({}, levelkeys);
7940
+ var currentKey = levelkeys[levelKey.keyFormat];
7941
+ // Ignore duplicate playlist KEY tags
7942
+ if (!(currentKey != null && currentKey.matches(levelKey))) {
7943
+ if (currentKey) {
7944
+ levelkeys = _extends({}, levelkeys);
7945
+ }
7946
+ levelkeys[levelKey.keyFormat] = levelKey;
7932
7947
  }
7933
- levelkeys[levelKey.keyFormat] = levelKey;
7934
7948
  } else {
7935
7949
  logger.warn("[Keys] Ignoring invalid EXT-X-KEY tag: \"" + value1 + "\"");
7936
7950
  }
@@ -8154,7 +8168,7 @@
8154
8168
  // No uri is allowed when METHOD is NONE
8155
8169
  var resolvedUri = decrypturi ? M3U8Parser.resolve(decrypturi, baseurl) : '';
8156
8170
  var keyFormatVersions = (decryptkeyformatversions ? decryptkeyformatversions : '1').split('/').map(Number).filter(Number.isFinite);
8157
- return new LevelKey(decryptmethod, resolvedUri, decryptkeyformat, keyFormatVersions, decryptiv);
8171
+ return new LevelKey(decryptmethod, resolvedUri, decryptkeyformat, keyFormatVersions, decryptiv, keyAttrs.KEYID);
8158
8172
  }
8159
8173
  function parseStartTimeOffset(startAttributes) {
8160
8174
  var startAttrs = new AttrList(startAttributes);
@@ -18883,9 +18897,6 @@
18883
18897
  }
18884
18898
  return Number.POSITIVE_INFINITY;
18885
18899
  }();
18886
- function hexToArrayBuffer(str) {
18887
- return Uint8Array.from(str.replace(/^0x/, '').replace(/([\da-fA-F]{2}) ?/g, '0x$1 ').replace(/ +$/, '').split(' ')).buffer;
18888
- }
18889
18900
  var ID3TrackController = /*#__PURE__*/function () {
18890
18901
  function ID3TrackController(hls) {
18891
18902
  var _this = this;
@@ -20524,7 +20535,7 @@
20524
20535
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
20525
20536
  }
20526
20537
 
20527
- var version = "1.6.7-0.canary.11368";
20538
+ var version = "1.6.7-0.canary.11369";
20528
20539
 
20529
20540
  // ensure the worker ends up in the bundle
20530
20541
  // If the worker should not be included this gets aliased to empty.js