hls.js 1.6.3-0.canary.11254 → 1.6.3-0.canary.11257

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.3-0.canary.11254"}`);
526
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.3-0.canary.11257"}`);
527
527
  } catch (e) {
528
528
  /* log fn threw an exception. All logger methods are no-ops. */
529
529
  return createLogger();
@@ -8435,8 +8435,11 @@ class BaseStreamController extends TaskLoop {
8435
8435
  if (this.fragCurrent === null) {
8436
8436
  keyLoadingPromise = Promise.reject(new Error(`frag load aborted, context changed in KEY_LOADING`));
8437
8437
  }
8438
- } else if (!frag.encrypted && details.encryptedFragments.length) {
8439
- this.keyLoader.loadClear(frag, details.encryptedFragments);
8438
+ } else if (!frag.encrypted) {
8439
+ keyLoadingPromise = this.keyLoader.loadClear(frag, details.encryptedFragments);
8440
+ if (keyLoadingPromise) {
8441
+ this.log(`[eme] blocking frag load until media-keys acquired`);
8442
+ }
8440
8443
  }
8441
8444
  const fragPrevious = this.fragPrevious;
8442
8445
  if (isMediaFragment(frag) && (!fragPrevious || frag.sn !== fragPrevious.sn)) {
@@ -17784,6 +17787,8 @@ const hlsDefaultConfig = _objectSpread2(_objectSpread2({
17784
17787
  // used by eme-controller
17785
17788
  requestMediaKeySystemAccessFunc: null,
17786
17789
  // used by eme-controller
17790
+ requireKeySystemAccessOnStart: false,
17791
+ // used by eme-controller
17787
17792
  testBandwidth: true,
17788
17793
  progressive: false,
17789
17794
  lowLatencyMode: true,
@@ -19892,7 +19897,7 @@ function assignTrackIdsByGroup(tracks) {
19892
19897
  });
19893
19898
  }
19894
19899
 
19895
- const version = "1.6.3-0.canary.11254";
19900
+ const version = "1.6.3-0.canary.11257";
19896
19901
 
19897
19902
  // ensure the worker ends up in the bundle
19898
19903
  // If the worker should not be included this gets aliased to empty.js
@@ -21642,22 +21647,35 @@ class KeyLoader {
21642
21647
  });
21643
21648
  }
21644
21649
  loadClear(loadingFrag, encryptedFragments) {
21645
- if (this.emeController && this.config.emeEnabled) {
21646
- // access key-system with nearest key on start (loaidng frag is unencrypted)
21647
- const {
21648
- sn,
21649
- cc
21650
- } = loadingFrag;
21651
- for (let i = 0; i < encryptedFragments.length; i++) {
21652
- const frag = encryptedFragments[i];
21653
- if (cc <= frag.cc && (sn === 'initSegment' || frag.sn === 'initSegment' || sn < frag.sn)) {
21654
- this.emeController.selectKeySystemFormat(frag).then(keySystemFormat => {
21655
- frag.setKeyFormat(keySystemFormat);
21656
- });
21657
- break;
21650
+ if (this.emeController && this.config.emeEnabled && !this.emeController.getSelectedKeySystemFormats().length) {
21651
+ // access key-system with nearest key on start (loading frag is unencrypted)
21652
+ if (encryptedFragments.length) {
21653
+ const {
21654
+ sn,
21655
+ cc
21656
+ } = loadingFrag;
21657
+ for (let i = 0; i < encryptedFragments.length; i++) {
21658
+ const frag = encryptedFragments[i];
21659
+ if (cc <= frag.cc && (sn === 'initSegment' || frag.sn === 'initSegment' || sn < frag.sn)) {
21660
+ return this.emeController.selectKeySystemFormat(frag).then(keySystemFormat => {
21661
+ frag.setKeyFormat(keySystemFormat);
21662
+ if (this.emeController && this.config.requireKeySystemAccessOnStart) {
21663
+ const keySystem = emptyEsExports.keySystemFormatToKeySystemDomain(keySystemFormat);
21664
+ if (keySystem) {
21665
+ return this.emeController.getKeySystemAccess([keySystem]);
21666
+ }
21667
+ }
21668
+ });
21669
+ }
21670
+ }
21671
+ } else if (this.config.requireKeySystemAccessOnStart) {
21672
+ const keySystemsInConfig = emptyEsExports.getKeySystemsForConfig(this.config);
21673
+ if (keySystemsInConfig.length) {
21674
+ return this.emeController.getKeySystemAccess(keySystemsInConfig);
21658
21675
  }
21659
21676
  }
21660
21677
  }
21678
+ return null;
21661
21679
  }
21662
21680
  load(frag) {
21663
21681
  if (!frag.decryptdata && frag.encrypted && this.emeController && this.config.emeEnabled) {