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

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.11369"}`);
526
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.7-0.canary.11371"}`);
527
527
  } catch (e) {
528
528
  /* log fn threw an exception. All logger methods are no-ops. */
529
529
  return createLogger();
@@ -8423,7 +8423,7 @@ class BaseStreamController extends TaskLoop {
8423
8423
  keyLoadingPromise = Promise.reject(new Error(`frag load aborted, context changed in KEY_LOADING`));
8424
8424
  }
8425
8425
  } else if (!frag.encrypted) {
8426
- keyLoadingPromise = this.keyLoader.loadClear(frag, details.encryptedFragments);
8426
+ keyLoadingPromise = this.keyLoader.loadClear(frag, details.encryptedFragments, this.startFragRequested);
8427
8427
  if (keyLoadingPromise) {
8428
8428
  this.log(`[eme] blocking frag load until media-keys acquired`);
8429
8429
  }
@@ -19904,7 +19904,7 @@ function assignTrackIdsByGroup(tracks) {
19904
19904
  });
19905
19905
  }
19906
19906
 
19907
- const version = "1.6.7-0.canary.11369";
19907
+ const version = "1.6.7-0.canary.11371";
19908
19908
 
19909
19909
  // ensure the worker ends up in the bundle
19910
19910
  // If the worker should not be included this gets aliased to empty.js
@@ -21657,29 +21657,28 @@ class KeyLoader {
21657
21657
  networkDetails
21658
21658
  });
21659
21659
  }
21660
- loadClear(loadingFrag, encryptedFragments) {
21660
+ loadClear(loadingFrag, encryptedFragments, startFragRequested) {
21661
21661
  if (this.emeController && this.config.emeEnabled && !this.emeController.getSelectedKeySystemFormats().length) {
21662
- // access key-system with nearest key on start (loading frag is unencrypted)
21662
+ // Access key-system with nearest key on start (loading frag is unencrypted)
21663
21663
  if (encryptedFragments.length) {
21664
- const {
21665
- sn,
21666
- cc
21667
- } = loadingFrag;
21668
- for (let i = 0; i < encryptedFragments.length; i++) {
21664
+ for (let i = 0, l = encryptedFragments.length; i < l; i++) {
21669
21665
  const frag = encryptedFragments[i];
21670
- if (cc <= frag.cc && (sn === 'initSegment' || frag.sn === 'initSegment' || sn < frag.sn)) {
21666
+ // Loading at or before segment with EXT-X-KEY, or first frag loading and last EXT-X-KEY
21667
+ if (loadingFrag.cc <= frag.cc && (!isMediaFragment(loadingFrag) || !isMediaFragment(frag) || loadingFrag.sn < frag.sn) || !startFragRequested && i == l - 1) {
21671
21668
  return this.emeController.selectKeySystemFormat(frag).then(keySystemFormat => {
21669
+ if (!this.emeController) {
21670
+ return;
21671
+ }
21672
21672
  frag.setKeyFormat(keySystemFormat);
21673
- if (this.emeController && this.config.requireKeySystemAccessOnStart) {
21674
- const keySystem = emptyEsExports.keySystemFormatToKeySystemDomain(keySystemFormat);
21675
- if (keySystem) {
21676
- return this.emeController.getKeySystemAccess([keySystem]);
21677
- }
21673
+ const keySystem = emptyEsExports.keySystemFormatToKeySystemDomain(keySystemFormat);
21674
+ if (keySystem) {
21675
+ return this.emeController.getKeySystemAccess([keySystem]);
21678
21676
  }
21679
21677
  });
21680
21678
  }
21681
21679
  }
21682
- } else if (this.config.requireKeySystemAccessOnStart) {
21680
+ }
21681
+ if (this.config.requireKeySystemAccessOnStart) {
21683
21682
  const keySystemsInConfig = emptyEsExports.getKeySystemsForConfig(this.config);
21684
21683
  if (keySystemsInConfig.length) {
21685
21684
  return this.emeController.getKeySystemAccess(keySystemsInConfig);