hls.js 1.6.7-0.canary.11366 → 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.
@@ -523,7 +523,7 @@ function enableLogs(debugConfig, context, id) {
523
523
  // Some browsers don't allow to use bind on console object anyway
524
524
  // fallback to default if needed
525
525
  try {
526
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.7-0.canary.11366"}`);
526
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.7-0.canary.11369"}`);
527
527
  } catch (e) {
528
528
  /* log fn threw an exception. All logger methods are no-ops. */
529
529
  return createLogger();
@@ -668,6 +668,9 @@ const Hex = {
668
668
  return str;
669
669
  }
670
670
  };
671
+ function hexToArrayBuffer(str) {
672
+ return Uint8Array.from(str.replace(/^0x/, '').replace(/([\da-fA-F]{2}) ?/g, '0x$1 ').replace(/ +$/, '').split(' ')).buffer;
673
+ }
671
674
 
672
675
  var urlToolkit = {exports: {}};
673
676
 
@@ -4684,7 +4687,7 @@ function getAesModeFromFullSegmentMethod(method) {
4684
4687
  class LevelKey {
4685
4688
  static clearKeyUriToKeyIdMap() {
4686
4689
  }
4687
- constructor(method, uri, format, formatversions = [1], iv = null) {
4690
+ constructor(method, uri, format, formatversions = [1], iv = null, keyId) {
4688
4691
  this.uri = void 0;
4689
4692
  this.method = void 0;
4690
4693
  this.keyFormat = void 0;
@@ -4702,6 +4705,13 @@ class LevelKey {
4702
4705
  this.iv = iv;
4703
4706
  this.encrypted = method ? method !== 'NONE' : false;
4704
4707
  this.isCommonEncryption = this.encrypted && !isFullSegmentEncryption(method);
4708
+ if (keyId != null && keyId.startsWith('0x')) {
4709
+ this.keyId = new Uint8Array(hexToArrayBuffer(keyId));
4710
+ }
4711
+ }
4712
+ matches(key) {
4713
+ var _key$iv, _this$iv;
4714
+ 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(','));
4705
4715
  }
4706
4716
  isSupported() {
4707
4717
  // If it's Segment encryption or No encryption, just select that key system
@@ -5178,10 +5188,14 @@ class M3U8Parser {
5178
5188
  if (!levelkeys) {
5179
5189
  levelkeys = {};
5180
5190
  }
5181
- if (levelkeys[levelKey.keyFormat]) {
5182
- levelkeys = _extends({}, levelkeys);
5191
+ const currentKey = levelkeys[levelKey.keyFormat];
5192
+ // Ignore duplicate playlist KEY tags
5193
+ if (!(currentKey != null && currentKey.matches(levelKey))) {
5194
+ if (currentKey) {
5195
+ levelkeys = _extends({}, levelkeys);
5196
+ }
5197
+ levelkeys[levelKey.keyFormat] = levelKey;
5183
5198
  }
5184
- levelkeys[levelKey.keyFormat] = levelKey;
5185
5199
  } else {
5186
5200
  logger.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${value1}"`);
5187
5201
  }
@@ -5404,7 +5418,7 @@ function parseKey(keyTagAttributes, baseurl, parsed) {
5404
5418
  // No uri is allowed when METHOD is NONE
5405
5419
  const resolvedUri = decrypturi ? M3U8Parser.resolve(decrypturi, baseurl) : '';
5406
5420
  const keyFormatVersions = (decryptkeyformatversions ? decryptkeyformatversions : '1').split('/').map(Number).filter(Number.isFinite);
5407
- return new LevelKey(decryptmethod, resolvedUri, decryptkeyformat, keyFormatVersions, decryptiv);
5421
+ return new LevelKey(decryptmethod, resolvedUri, decryptkeyformat, keyFormatVersions, decryptiv, keyAttrs.KEYID);
5408
5422
  }
5409
5423
  function parseStartTimeOffset(startAttributes) {
5410
5424
  const startAttrs = new AttrList(startAttributes);
@@ -18727,9 +18741,6 @@ const MAX_CUE_ENDTIME = (() => {
18727
18741
  }
18728
18742
  return Number.POSITIVE_INFINITY;
18729
18743
  })();
18730
- function hexToArrayBuffer(str) {
18731
- return Uint8Array.from(str.replace(/^0x/, '').replace(/([\da-fA-F]{2}) ?/g, '0x$1 ').replace(/ +$/, '').split(' ')).buffer;
18732
- }
18733
18744
  class ID3TrackController {
18734
18745
  constructor(hls) {
18735
18746
  this.hls = void 0;
@@ -19893,7 +19904,7 @@ function assignTrackIdsByGroup(tracks) {
19893
19904
  });
19894
19905
  }
19895
19906
 
19896
- const version = "1.6.7-0.canary.11366";
19907
+ const version = "1.6.7-0.canary.11369";
19897
19908
 
19898
19909
  // ensure the worker ends up in the bundle
19899
19910
  // If the worker should not be included this gets aliased to empty.js