stormcloud-video-player 0.8.27 → 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
@@ -5051,6 +5051,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
5051
5051
  this.vmapBreaks = [];
5052
5052
  this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
5053
5053
  this.streamCorrelator = generateCorrelator();
5054
+ this.viewCorrelator = generateCorrelator();
5054
5055
  this.consentSignals = {};
5055
5056
  this.podCounter = 0;
5056
5057
  this.podAssignedByPrefetch = false;
@@ -5486,7 +5487,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
5486
5487
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
5487
5488
  var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
5488
5489
  var urlWithMacros = applyVastMacros(baseUrl, {
5489
- correlator: generateCorrelator(),
5490
+ correlator: this.viewCorrelator,
5490
5491
  streamCorrelator: this.streamCorrelator,
5491
5492
  pod: this.podCounter > 0 ? this.podCounter : void 0,
5492
5493
  adPosition: this.adRequestPositionInBreak,
@@ -5532,7 +5533,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
5532
5533
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
5533
5534
  var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
5534
5535
  var urlWithMacros = applyVastMacros(baseUrl, {
5535
- correlator: generateCorrelator(),
5536
+ correlator: this.viewCorrelator,
5536
5537
  streamCorrelator: this.streamCorrelator,
5537
5538
  pod: this.podCounter > 0 ? this.podCounter : void 0,
5538
5539
  podMaxAds: podParams.maxAds,
@@ -7383,7 +7384,18 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7383
7384
  // IMA event listeners
7384
7385
  // ───────────────────────────────────────────────────────────────
7385
7386
  function get() {
7386
- return !!this.host.config.optimizedPods;
7387
+ return this.host.config.optimizedPods !== false;
7388
+ }
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];
7387
7399
  }
7388
7400
  },
7389
7401
  {
@@ -7555,7 +7567,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7555
7567
  // ───────────────────────────────────────────────────────────────
7556
7568
  function handleAdStart(_marker) {
7557
7569
  return _async_to_generator(function() {
7558
- 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;
7559
7571
  return _ts_generator(this, function(_state) {
7560
7572
  switch(_state.label){
7561
7573
  case 0:
@@ -7647,8 +7659,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7647
7659
  if (this.debug) {
7648
7660
  console.log("[CONTINUOUS-FETCH] Generating new ad URLs...");
7649
7661
  }
7650
- firstAdUrlArray = this.host.generateVastUrls(baseVastUrl, 1);
7651
- firstAdUrl = firstAdUrlArray[0];
7662
+ firstAdUrl = this.nextAdRequestUrl(baseVastUrl);
7652
7663
  this.adRequestQueue = [];
7653
7664
  }
7654
7665
  if (!firstAdUrl) {
@@ -7705,11 +7716,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7705
7716
  preloadedController.resume();
7706
7717
  this.timing.consecutiveFailures = 0;
7707
7718
  this.startContinuousFetching(baseVastUrl);
7708
- if (!this.preloadPool.active) {
7709
- this.preloadPool.active = true;
7710
- }
7711
- if (!this.preloadPool.isLoopRunning) {
7712
- 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
+ }
7713
7726
  }
7714
7727
  return [
7715
7728
  4,
@@ -7769,7 +7782,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7769
7782
  case 11:
7770
7783
  this.timing.consecutiveFailures = 0;
7771
7784
  this.startContinuousFetching(baseVastUrl);
7772
- if (!this.preloadPool.active) {
7785
+ if (!this.optimizedPodsEnabled && !this.preloadPool.active) {
7773
7786
  this.preloadPool.startPreloadPool(baseVastUrl, []);
7774
7787
  }
7775
7788
  return [
@@ -7834,7 +7847,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7834
7847
  this.swapToPreloadedAdPlayer(fallbackPreloaded.adController);
7835
7848
  this.timing.consecutiveFailures = 0;
7836
7849
  this.startContinuousFetching(baseVastUrl);
7837
- if (!this.preloadPool.active) {
7850
+ if (!this.optimizedPodsEnabled && !this.preloadPool.active) {
7838
7851
  this.preloadPool.active = true;
7839
7852
  this.preloadPool.preloadPoolLoop(baseVastUrl);
7840
7853
  }
@@ -7984,9 +7997,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7984
7997
  if (podCount === 1) {
7985
7998
  this.continuousFetchingActive = true;
7986
7999
  this.startContinuousFetching(baseVastUrl);
7987
- if (!this.preloadPool.active) {
7988
- this.preloadPool.startPreloadPool(baseVastUrl, []);
7989
- }
7990
8000
  }
7991
8001
  return [
7992
8002
  2,
@@ -8127,7 +8137,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
8127
8137
  "continue"
8128
8138
  ];
8129
8139
  case 2:
8130
- newAdUrl = _this.host.generateVastUrls(baseVastUrl, 1)[0];
8140
+ newAdUrl = _this.nextAdRequestUrl(baseVastUrl);
8131
8141
  if (!(!newAdUrl || _this.timing.failedVastUrls.has(newAdUrl) || _this.timing.isUrlInCooldown(newAdUrl))) return [
8132
8142
  3,
8133
8143
  4
@@ -9523,7 +9533,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
9523
9533
  }
9524
9534
  this.adConfig.beginNewAdPod();
9525
9535
  this.adConfig.podAssignedByPrefetch = true;
9526
- var optimizedPods = !!this.config.optimizedPods;
9536
+ var optimizedPods = this.config.optimizedPods !== false;
9527
9537
  var breakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0;
9528
9538
  var generatedUrls = optimizedPods ? [
9529
9539
  this.generatePodVastUrl(baseVastUrl, breakDurationMs)