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.
package/dist/hls.mjs CHANGED
@@ -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();
@@ -8851,7 +8851,7 @@ class BaseStreamController extends TaskLoop {
8851
8851
  keyLoadingPromise = Promise.reject(new Error(`frag load aborted, context changed in KEY_LOADING`));
8852
8852
  }
8853
8853
  } else if (!frag.encrypted) {
8854
- keyLoadingPromise = this.keyLoader.loadClear(frag, details.encryptedFragments);
8854
+ keyLoadingPromise = this.keyLoader.loadClear(frag, details.encryptedFragments, this.startFragRequested);
8855
8855
  if (keyLoadingPromise) {
8856
8856
  this.log(`[eme] blocking frag load until media-keys acquired`);
8857
8857
  }
@@ -10186,7 +10186,7 @@ function requireEventemitter3 () {
10186
10186
  var eventemitter3Exports = requireEventemitter3();
10187
10187
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
10188
10188
 
10189
- const version = "1.6.7-0.canary.11369";
10189
+ const version = "1.6.7-0.canary.11371";
10190
10190
 
10191
10191
  // ensure the worker ends up in the bundle
10192
10192
  // If the worker should not be included this gets aliased to empty.js
@@ -33589,29 +33589,28 @@ class KeyLoader {
33589
33589
  networkDetails
33590
33590
  });
33591
33591
  }
33592
- loadClear(loadingFrag, encryptedFragments) {
33592
+ loadClear(loadingFrag, encryptedFragments, startFragRequested) {
33593
33593
  if (this.emeController && this.config.emeEnabled && !this.emeController.getSelectedKeySystemFormats().length) {
33594
- // access key-system with nearest key on start (loading frag is unencrypted)
33594
+ // Access key-system with nearest key on start (loading frag is unencrypted)
33595
33595
  if (encryptedFragments.length) {
33596
- const {
33597
- sn,
33598
- cc
33599
- } = loadingFrag;
33600
- for (let i = 0; i < encryptedFragments.length; i++) {
33596
+ for (let i = 0, l = encryptedFragments.length; i < l; i++) {
33601
33597
  const frag = encryptedFragments[i];
33602
- if (cc <= frag.cc && (sn === 'initSegment' || frag.sn === 'initSegment' || sn < frag.sn)) {
33598
+ // Loading at or before segment with EXT-X-KEY, or first frag loading and last EXT-X-KEY
33599
+ if (loadingFrag.cc <= frag.cc && (!isMediaFragment(loadingFrag) || !isMediaFragment(frag) || loadingFrag.sn < frag.sn) || !startFragRequested && i == l - 1) {
33603
33600
  return this.emeController.selectKeySystemFormat(frag).then(keySystemFormat => {
33601
+ if (!this.emeController) {
33602
+ return;
33603
+ }
33604
33604
  frag.setKeyFormat(keySystemFormat);
33605
- if (this.emeController && this.config.requireKeySystemAccessOnStart) {
33606
- const keySystem = keySystemFormatToKeySystemDomain(keySystemFormat);
33607
- if (keySystem) {
33608
- return this.emeController.getKeySystemAccess([keySystem]);
33609
- }
33605
+ const keySystem = keySystemFormatToKeySystemDomain(keySystemFormat);
33606
+ if (keySystem) {
33607
+ return this.emeController.getKeySystemAccess([keySystem]);
33610
33608
  }
33611
33609
  });
33612
33610
  }
33613
33611
  }
33614
- } else if (this.config.requireKeySystemAccessOnStart) {
33612
+ }
33613
+ if (this.config.requireKeySystemAccessOnStart) {
33615
33614
  const keySystemsInConfig = getKeySystemsForConfig(this.config);
33616
33615
  if (keySystemsInConfig.length) {
33617
33616
  return this.emeController.getKeySystemAccess(keySystemsInConfig);