stormcloud-video-player 0.8.28 → 0.8.29

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/lib/index.cjs CHANGED
@@ -7387,6 +7387,17 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7387
7387
  return this.host.config.optimizedPods !== false;
7388
7388
  }
7389
7389
  },
7390
+ {
7391
+ key: "nextAdRequestUrl",
7392
+ value: function nextAdRequestUrl(baseVastUrl) {
7393
+ if (this.optimizedPodsEnabled) {
7394
+ var remaining = Math.min(this.timing.getWallClockRemainingAdMs(), this.timing.getDurationBudgetRemainingMs());
7395
+ var breakDurationMs = remaining > 0 ? remaining : void 0;
7396
+ return this.host.generatePodVastUrl(baseVastUrl, breakDurationMs);
7397
+ }
7398
+ return this.host.generateVastUrls(baseVastUrl, 1)[0];
7399
+ }
7400
+ },
7390
7401
  {
7391
7402
  key: "attachImaEventListeners",
7392
7403
  value: function attachImaEventListeners() {
@@ -7556,7 +7567,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7556
7567
  // ───────────────────────────────────────────────────────────────
7557
7568
  function handleAdStart(_marker) {
7558
7569
  return _async_to_generator(function() {
7559
- var scheduled, tags, baseVastUrl, adBreakDurationMs, mode, currentMuted, currentVolume, podPlayed, firstAdUrl, usePreloadedAd, preloadedController, preloaded, firstAdUrlArray, adPlayer, preservedMuted, preservedVolume, adVolume, adPlayer1, adVolume1, error, fallbackPreloaded, ap, adVolume2, fallbackError;
7570
+ var scheduled, tags, baseVastUrl, adBreakDurationMs, mode, currentMuted, currentVolume, podPlayed, firstAdUrl, usePreloadedAd, preloadedController, preloaded, adPlayer, preservedMuted, preservedVolume, adVolume, adPlayer1, adVolume1, error, fallbackPreloaded, ap, adVolume2, fallbackError;
7560
7571
  return _ts_generator(this, function(_state) {
7561
7572
  switch(_state.label){
7562
7573
  case 0:
@@ -7648,8 +7659,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7648
7659
  if (this.debug) {
7649
7660
  console.log("[CONTINUOUS-FETCH] Generating new ad URLs...");
7650
7661
  }
7651
- firstAdUrlArray = this.host.generateVastUrls(baseVastUrl, 1);
7652
- firstAdUrl = firstAdUrlArray[0];
7662
+ firstAdUrl = this.nextAdRequestUrl(baseVastUrl);
7653
7663
  this.adRequestQueue = [];
7654
7664
  }
7655
7665
  if (!firstAdUrl) {
@@ -7706,11 +7716,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7706
7716
  preloadedController.resume();
7707
7717
  this.timing.consecutiveFailures = 0;
7708
7718
  this.startContinuousFetching(baseVastUrl);
7709
- if (!this.preloadPool.active) {
7710
- this.preloadPool.active = true;
7711
- }
7712
- if (!this.preloadPool.isLoopRunning) {
7713
- this.preloadPool.preloadPoolLoop(baseVastUrl);
7719
+ if (!this.optimizedPodsEnabled) {
7720
+ if (!this.preloadPool.active) {
7721
+ this.preloadPool.active = true;
7722
+ }
7723
+ if (!this.preloadPool.isLoopRunning) {
7724
+ this.preloadPool.preloadPoolLoop(baseVastUrl);
7725
+ }
7714
7726
  }
7715
7727
  return [
7716
7728
  4,
@@ -7770,7 +7782,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7770
7782
  case 11:
7771
7783
  this.timing.consecutiveFailures = 0;
7772
7784
  this.startContinuousFetching(baseVastUrl);
7773
- if (!this.preloadPool.active) {
7785
+ if (!this.optimizedPodsEnabled && !this.preloadPool.active) {
7774
7786
  this.preloadPool.startPreloadPool(baseVastUrl, []);
7775
7787
  }
7776
7788
  return [
@@ -7835,7 +7847,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7835
7847
  this.swapToPreloadedAdPlayer(fallbackPreloaded.adController);
7836
7848
  this.timing.consecutiveFailures = 0;
7837
7849
  this.startContinuousFetching(baseVastUrl);
7838
- if (!this.preloadPool.active) {
7850
+ if (!this.optimizedPodsEnabled && !this.preloadPool.active) {
7839
7851
  this.preloadPool.active = true;
7840
7852
  this.preloadPool.preloadPoolLoop(baseVastUrl);
7841
7853
  }
@@ -7985,9 +7997,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7985
7997
  if (podCount === 1) {
7986
7998
  this.continuousFetchingActive = true;
7987
7999
  this.startContinuousFetching(baseVastUrl);
7988
- if (!this.preloadPool.active) {
7989
- this.preloadPool.startPreloadPool(baseVastUrl, []);
7990
- }
7991
8000
  }
7992
8001
  return [
7993
8002
  2,
@@ -8128,7 +8137,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
8128
8137
  "continue"
8129
8138
  ];
8130
8139
  case 2:
8131
- newAdUrl = _this.host.generateVastUrls(baseVastUrl, 1)[0];
8140
+ newAdUrl = _this.nextAdRequestUrl(baseVastUrl);
8132
8141
  if (!(!newAdUrl || _this.timing.failedVastUrls.has(newAdUrl) || _this.timing.isUrlInCooldown(newAdUrl))) return [
8133
8142
  3,
8134
8143
  4