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.js CHANGED
@@ -4839,6 +4839,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
4839
4839
  this.vmapBreaks = [];
4840
4840
  this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
4841
4841
  this.streamCorrelator = generateCorrelator();
4842
+ this.viewCorrelator = generateCorrelator();
4842
4843
  this.consentSignals = {};
4843
4844
  this.podCounter = 0;
4844
4845
  this.podAssignedByPrefetch = false;
@@ -5274,7 +5275,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
5274
5275
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
5275
5276
  var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
5276
5277
  var urlWithMacros = applyVastMacros(baseUrl, {
5277
- correlator: generateCorrelator(),
5278
+ correlator: this.viewCorrelator,
5278
5279
  streamCorrelator: this.streamCorrelator,
5279
5280
  pod: this.podCounter > 0 ? this.podCounter : void 0,
5280
5281
  adPosition: this.adRequestPositionInBreak,
@@ -5320,7 +5321,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
5320
5321
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
5321
5322
  var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
5322
5323
  var urlWithMacros = applyVastMacros(baseUrl, {
5323
- correlator: generateCorrelator(),
5324
+ correlator: this.viewCorrelator,
5324
5325
  streamCorrelator: this.streamCorrelator,
5325
5326
  pod: this.podCounter > 0 ? this.podCounter : void 0,
5326
5327
  podMaxAds: podParams.maxAds,
@@ -7176,7 +7177,18 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7176
7177
  // IMA event listeners
7177
7178
  // ───────────────────────────────────────────────────────────────
7178
7179
  function get() {
7179
- return !!this.host.config.optimizedPods;
7180
+ return this.host.config.optimizedPods !== false;
7181
+ }
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];
7180
7192
  }
7181
7193
  },
7182
7194
  {
@@ -7348,7 +7360,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7348
7360
  // ───────────────────────────────────────────────────────────────
7349
7361
  function handleAdStart(_marker) {
7350
7362
  return _async_to_generator(function() {
7351
- 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;
7352
7364
  return _ts_generator(this, function(_state) {
7353
7365
  switch(_state.label){
7354
7366
  case 0:
@@ -7440,8 +7452,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7440
7452
  if (this.debug) {
7441
7453
  console.log("[CONTINUOUS-FETCH] Generating new ad URLs...");
7442
7454
  }
7443
- firstAdUrlArray = this.host.generateVastUrls(baseVastUrl, 1);
7444
- firstAdUrl = firstAdUrlArray[0];
7455
+ firstAdUrl = this.nextAdRequestUrl(baseVastUrl);
7445
7456
  this.adRequestQueue = [];
7446
7457
  }
7447
7458
  if (!firstAdUrl) {
@@ -7498,11 +7509,13 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7498
7509
  preloadedController.resume();
7499
7510
  this.timing.consecutiveFailures = 0;
7500
7511
  this.startContinuousFetching(baseVastUrl);
7501
- if (!this.preloadPool.active) {
7502
- this.preloadPool.active = true;
7503
- }
7504
- if (!this.preloadPool.isLoopRunning) {
7505
- 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
+ }
7506
7519
  }
7507
7520
  return [
7508
7521
  4,
@@ -7562,7 +7575,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7562
7575
  case 11:
7563
7576
  this.timing.consecutiveFailures = 0;
7564
7577
  this.startContinuousFetching(baseVastUrl);
7565
- if (!this.preloadPool.active) {
7578
+ if (!this.optimizedPodsEnabled && !this.preloadPool.active) {
7566
7579
  this.preloadPool.startPreloadPool(baseVastUrl, []);
7567
7580
  }
7568
7581
  return [
@@ -7627,7 +7640,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7627
7640
  this.swapToPreloadedAdPlayer(fallbackPreloaded.adController);
7628
7641
  this.timing.consecutiveFailures = 0;
7629
7642
  this.startContinuousFetching(baseVastUrl);
7630
- if (!this.preloadPool.active) {
7643
+ if (!this.optimizedPodsEnabled && !this.preloadPool.active) {
7631
7644
  this.preloadPool.active = true;
7632
7645
  this.preloadPool.preloadPoolLoop(baseVastUrl);
7633
7646
  }
@@ -7777,9 +7790,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7777
7790
  if (podCount === 1) {
7778
7791
  this.continuousFetchingActive = true;
7779
7792
  this.startContinuousFetching(baseVastUrl);
7780
- if (!this.preloadPool.active) {
7781
- this.preloadPool.startPreloadPool(baseVastUrl, []);
7782
- }
7783
7793
  }
7784
7794
  return [
7785
7795
  2,
@@ -7920,7 +7930,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7920
7930
  "continue"
7921
7931
  ];
7922
7932
  case 2:
7923
- newAdUrl = _this.host.generateVastUrls(baseVastUrl, 1)[0];
7933
+ newAdUrl = _this.nextAdRequestUrl(baseVastUrl);
7924
7934
  if (!(!newAdUrl || _this.timing.failedVastUrls.has(newAdUrl) || _this.timing.isUrlInCooldown(newAdUrl))) return [
7925
7935
  3,
7926
7936
  4
@@ -9317,7 +9327,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
9317
9327
  }
9318
9328
  this.adConfig.beginNewAdPod();
9319
9329
  this.adConfig.podAssignedByPrefetch = true;
9320
- var optimizedPods = !!this.config.optimizedPods;
9330
+ var optimizedPods = this.config.optimizedPods !== false;
9321
9331
  var breakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0;
9322
9332
  var generatedUrls = optimizedPods ? [
9323
9333
  this.generatePodVastUrl(baseVastUrl, breakDurationMs)