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.js CHANGED
@@ -7180,6 +7180,17 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7180
7180
  return this.host.config.optimizedPods !== false;
7181
7181
  }
7182
7182
  },
7183
+ {
7184
+ key: "nextAdRequestUrl",
7185
+ value: function nextAdRequestUrl(baseVastUrl) {
7186
+ if (this.optimizedPodsEnabled) {
7187
+ var remaining = Math.min(this.timing.getWallClockRemainingAdMs(), this.timing.getDurationBudgetRemainingMs());
7188
+ var breakDurationMs = remaining > 0 ? remaining : void 0;
7189
+ return this.host.generatePodVastUrl(baseVastUrl, breakDurationMs);
7190
+ }
7191
+ return this.host.generateVastUrls(baseVastUrl, 1)[0];
7192
+ }
7193
+ },
7183
7194
  {
7184
7195
  key: "attachImaEventListeners",
7185
7196
  value: function attachImaEventListeners() {
@@ -7349,7 +7360,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7349
7360
  // ───────────────────────────────────────────────────────────────
7350
7361
  function handleAdStart(_marker) {
7351
7362
  return _async_to_generator(function() {
7352
- 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;
7363
+ var scheduled, tags, baseVastUrl, adBreakDurationMs, mode, currentMuted, currentVolume, podPlayed, firstAdUrl, usePreloadedAd, preloadedController, preloaded, adPlayer, preservedMuted, preservedVolume, adVolume, adPlayer1, adVolume1, error, fallbackPreloaded, ap, adVolume2, fallbackError;
7353
7364
  return _ts_generator(this, function(_state) {
7354
7365
  switch(_state.label){
7355
7366
  case 0:
@@ -7441,8 +7452,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7441
7452
  if (this.debug) {
7442
7453
  console.log("[CONTINUOUS-FETCH] Generating new ad URLs...");
7443
7454
  }
7444
- firstAdUrlArray = this.host.generateVastUrls(baseVastUrl, 1);
7445
- firstAdUrl = firstAdUrlArray[0];
7455
+ firstAdUrl = this.nextAdRequestUrl(baseVastUrl);
7446
7456
  this.adRequestQueue = [];
7447
7457
  }
7448
7458
  if (!firstAdUrl) {
@@ -7499,11 +7509,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7499
7509
  preloadedController.resume();
7500
7510
  this.timing.consecutiveFailures = 0;
7501
7511
  this.startContinuousFetching(baseVastUrl);
7502
- if (!this.preloadPool.active) {
7503
- this.preloadPool.active = true;
7504
- }
7505
- if (!this.preloadPool.isLoopRunning) {
7506
- this.preloadPool.preloadPoolLoop(baseVastUrl);
7512
+ if (!this.optimizedPodsEnabled) {
7513
+ if (!this.preloadPool.active) {
7514
+ this.preloadPool.active = true;
7515
+ }
7516
+ if (!this.preloadPool.isLoopRunning) {
7517
+ this.preloadPool.preloadPoolLoop(baseVastUrl);
7518
+ }
7507
7519
  }
7508
7520
  return [
7509
7521
  4,
@@ -7563,7 +7575,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7563
7575
  case 11:
7564
7576
  this.timing.consecutiveFailures = 0;
7565
7577
  this.startContinuousFetching(baseVastUrl);
7566
- if (!this.preloadPool.active) {
7578
+ if (!this.optimizedPodsEnabled && !this.preloadPool.active) {
7567
7579
  this.preloadPool.startPreloadPool(baseVastUrl, []);
7568
7580
  }
7569
7581
  return [
@@ -7628,7 +7640,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7628
7640
  this.swapToPreloadedAdPlayer(fallbackPreloaded.adController);
7629
7641
  this.timing.consecutiveFailures = 0;
7630
7642
  this.startContinuousFetching(baseVastUrl);
7631
- if (!this.preloadPool.active) {
7643
+ if (!this.optimizedPodsEnabled && !this.preloadPool.active) {
7632
7644
  this.preloadPool.active = true;
7633
7645
  this.preloadPool.preloadPoolLoop(baseVastUrl);
7634
7646
  }
@@ -7778,9 +7790,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7778
7790
  if (podCount === 1) {
7779
7791
  this.continuousFetchingActive = true;
7780
7792
  this.startContinuousFetching(baseVastUrl);
7781
- if (!this.preloadPool.active) {
7782
- this.preloadPool.startPreloadPool(baseVastUrl, []);
7783
- }
7784
7793
  }
7785
7794
  return [
7786
7795
  2,
@@ -7921,7 +7930,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7921
7930
  "continue"
7922
7931
  ];
7923
7932
  case 2:
7924
- newAdUrl = _this.host.generateVastUrls(baseVastUrl, 1)[0];
7933
+ newAdUrl = _this.nextAdRequestUrl(baseVastUrl);
7925
7934
  if (!(!newAdUrl || _this.timing.failedVastUrls.has(newAdUrl) || _this.timing.isUrlInCooldown(newAdUrl))) return [
7926
7935
  3,
7927
7936
  4