stormcloud-video-player 0.5.4 → 0.5.5

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.d.cts CHANGED
@@ -173,6 +173,9 @@ declare class StormcloudVideoPlayer {
173
173
  private readonly minAdRequestIntervalMs;
174
174
  private readonly backoffBaseMs;
175
175
  private readonly maxBackoffMs;
176
+ private readonly continuousFetchWallClockBufferMs;
177
+ private readonly continuousFetchMaxIterations;
178
+ private continuousFetchQueueFullConsecutiveWaits;
176
179
  private placeholderContainer;
177
180
  private preloadPool;
178
181
  private readonly maxPreloadPoolSize;
@@ -180,9 +183,10 @@ declare class StormcloudVideoPlayer {
180
183
  private preloadPoolLoopRunning;
181
184
  constructor(config: StormcloudVideoPlayerConfig);
182
185
  private createAdPlayer;
186
+ private getAdPlayerTypeLabel;
183
187
  load(): Promise<void>;
184
188
  private attachImaEventListeners;
185
- private recreateImaController;
189
+ private recreateAdController;
186
190
  private ensurePlaceholderContainer;
187
191
  private showPlaceholderLayer;
188
192
  private hidePlaceholderLayer;
@@ -202,6 +206,7 @@ declare class StormcloudVideoPlayer {
202
206
  private sendHeartbeatIfNeeded;
203
207
  private fetchAdConfiguration;
204
208
  private isPrebidMode;
209
+ private isLgStbDevice;
205
210
  getCurrentAdIndex(): number;
206
211
  getTotalAdsInBreak(): number;
207
212
  private generateVastUrlsWithCorrelators;
@@ -221,6 +226,8 @@ declare class StormcloudVideoPlayer {
221
226
  private continuousFetchLoopRunning;
222
227
  private startContinuousFetching;
223
228
  private continuousFetchLoop;
229
+ private waitForQueueWithBackoff;
230
+ private logQueueState;
224
231
  private stopContinuousFetching;
225
232
  private tryNextAvailableAdWithRateLimit;
226
233
  private tryNextAvailableAd;
package/lib/index.d.ts CHANGED
@@ -173,6 +173,9 @@ declare class StormcloudVideoPlayer {
173
173
  private readonly minAdRequestIntervalMs;
174
174
  private readonly backoffBaseMs;
175
175
  private readonly maxBackoffMs;
176
+ private readonly continuousFetchWallClockBufferMs;
177
+ private readonly continuousFetchMaxIterations;
178
+ private continuousFetchQueueFullConsecutiveWaits;
176
179
  private placeholderContainer;
177
180
  private preloadPool;
178
181
  private readonly maxPreloadPoolSize;
@@ -180,9 +183,10 @@ declare class StormcloudVideoPlayer {
180
183
  private preloadPoolLoopRunning;
181
184
  constructor(config: StormcloudVideoPlayerConfig);
182
185
  private createAdPlayer;
186
+ private getAdPlayerTypeLabel;
183
187
  load(): Promise<void>;
184
188
  private attachImaEventListeners;
185
- private recreateImaController;
189
+ private recreateAdController;
186
190
  private ensurePlaceholderContainer;
187
191
  private showPlaceholderLayer;
188
192
  private hidePlaceholderLayer;
@@ -202,6 +206,7 @@ declare class StormcloudVideoPlayer {
202
206
  private sendHeartbeatIfNeeded;
203
207
  private fetchAdConfiguration;
204
208
  private isPrebidMode;
209
+ private isLgStbDevice;
205
210
  getCurrentAdIndex(): number;
206
211
  getTotalAdsInBreak(): number;
207
212
  private generateVastUrlsWithCorrelators;
@@ -221,6 +226,8 @@ declare class StormcloudVideoPlayer {
221
226
  private continuousFetchLoopRunning;
222
227
  private startContinuousFetching;
223
228
  private continuousFetchLoop;
229
+ private waitForQueueWithBackoff;
230
+ private logQueueState;
224
231
  private stopContinuousFetching;
225
232
  private tryNextAvailableAdWithRateLimit;
226
233
  private tryNextAvailableAd;
package/lib/index.js CHANGED
@@ -2057,10 +2057,10 @@ function createHlsAdPlayer(contentVideo, options) {
2057
2057
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
2058
2058
  if (contentVideo.paused) {
2059
2059
  console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback");
2060
- contentVideo.play().catch(function() {});
2061
2060
  } else {
2062
2061
  console.log("[HlsAdPlayer] Content video already playing in live mode");
2063
2062
  }
2063
+ contentVideo.play().catch(function() {});
2064
2064
  }
2065
2065
  emit("content_resume");
2066
2066
  }
@@ -2333,8 +2333,8 @@ function createHlsAdPlayer(contentVideo, options) {
2333
2333
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
2334
2334
  if (contentVideo.paused) {
2335
2335
  console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback on stop");
2336
- contentVideo.play().catch(function() {});
2337
2336
  }
2337
+ contentVideo.play().catch(function() {});
2338
2338
  }
2339
2339
  if (adHls) {
2340
2340
  adHls.destroy();
@@ -2343,6 +2343,8 @@ function createHlsAdPlayer(contentVideo, options) {
2343
2343
  if (adVideoElement) {
2344
2344
  adVideoElement.pause();
2345
2345
  adVideoElement.src = "";
2346
+ adVideoElement.remove();
2347
+ adVideoElement = void 0;
2346
2348
  }
2347
2349
  currentAd = void 0;
2348
2350
  return [
@@ -2993,10 +2995,10 @@ function createPrebidController(contentVideo, options) {
2993
2995
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
2994
2996
  if (contentVideo.paused) {
2995
2997
  console.log("".concat(LOG, " Content video paused in live mode, resuming playback"));
2996
- contentVideo.play().catch(function() {});
2997
2998
  } else {
2998
2999
  console.log("".concat(LOG, " Content video already playing in live mode"));
2999
3000
  }
3001
+ contentVideo.play().catch(function() {});
3000
3002
  }
3001
3003
  emit("content_resume");
3002
3004
  }
@@ -3362,8 +3364,8 @@ function createPrebidController(contentVideo, options) {
3362
3364
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
3363
3365
  if (contentVideo.paused) {
3364
3366
  console.log("".concat(LOG, " Content video paused in live mode, resuming playback on stop"));
3365
- contentVideo.play().catch(function() {});
3366
3367
  }
3368
+ contentVideo.play().catch(function() {});
3367
3369
  }
3368
3370
  if (adHls) {
3369
3371
  adHls.destroy();
@@ -3372,6 +3374,8 @@ function createPrebidController(contentVideo, options) {
3372
3374
  if (adVideoElement) {
3373
3375
  adVideoElement.pause();
3374
3376
  adVideoElement.src = "";
3377
+ adVideoElement.remove();
3378
+ adVideoElement = void 0;
3375
3379
  }
3376
3380
  currentAd = void 0;
3377
3381
  return [
@@ -4143,6 +4147,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4143
4147
  this.minAdRequestIntervalMs = 2500;
4144
4148
  this.backoffBaseMs = 1e3;
4145
4149
  this.maxBackoffMs = 15e3;
4150
+ this.continuousFetchWallClockBufferMs = 3e4;
4151
+ this.continuousFetchMaxIterations = 500;
4152
+ this.continuousFetchQueueFullConsecutiveWaits = 0;
4146
4153
  this.preloadPool = [];
4147
4154
  this.maxPreloadPoolSize = 3;
4148
4155
  this.preloadPoolActive = false;
@@ -4202,6 +4209,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4202
4209
  }
4203
4210
  }
4204
4211
  },
4212
+ {
4213
+ key: "getAdPlayerTypeLabel",
4214
+ value: function getAdPlayerTypeLabel() {
4215
+ var t = this.config.adPlayerType;
4216
+ if (t === "prebid") return "Prebid";
4217
+ if (t === "hls") return "HLS";
4218
+ return "IMA";
4219
+ }
4220
+ },
4205
4221
  {
4206
4222
  key: "load",
4207
4223
  value: function load() {
@@ -4691,6 +4707,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4691
4707
  }
4692
4708
  });
4693
4709
  this.ima.on("content_resume", function() {
4710
+ console.log("[StormcloudVideoPlayer] content_resume received, inAdBreak=%s, remaining=%s", _this.inAdBreak, _this.getRemainingAdMs());
4694
4711
  if (!_this.video.muted) {
4695
4712
  _this.video.muted = true;
4696
4713
  _this.video.volume = 0;
@@ -4721,15 +4738,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4721
4738
  }
4722
4739
  },
4723
4740
  {
4724
- key: "recreateImaController",
4725
- value: function recreateImaController() {
4741
+ key: "recreateAdController",
4742
+ value: function recreateAdController() {
4743
+ var label = this.getAdPlayerTypeLabel();
4726
4744
  if (this.config.debugAdTiming) {
4727
- console.log("[StormcloudVideoPlayer] Recreating ImaController for new ad");
4745
+ console.log("[StormcloudVideoPlayer] Recreating ad controller (".concat(label, ") for new ad"));
4728
4746
  }
4729
4747
  var shouldShowPlaceholder = this.inAdBreak && this.showAds;
4730
4748
  if (shouldShowPlaceholder && this.ima) {
4731
4749
  if (this.config.debugAdTiming) {
4732
- console.log("[StormcloudVideoPlayer] Showing placeholder before destroying old ImaController");
4750
+ console.log("[StormcloudVideoPlayer] Showing placeholder before destroying old ".concat(label, " controller"));
4733
4751
  }
4734
4752
  this.showPlaceholderLayer();
4735
4753
  this.ima.showPlaceholder();
@@ -4742,7 +4760,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4742
4760
  this.video.volume = 0;
4743
4761
  } catch (error) {
4744
4762
  if (this.config.debugAdTiming) {
4745
- console.warn("[StormcloudVideoPlayer] Error destroying old ImaController:", error);
4763
+ console.warn("[StormcloudVideoPlayer] Error destroying old ".concat(label, " controller:"), error);
4746
4764
  }
4747
4765
  }
4748
4766
  }
@@ -4822,7 +4840,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4822
4840
  });
4823
4841
  }
4824
4842
  if (this.config.debugAdTiming) {
4825
- console.log("[StormcloudVideoPlayer] Showing placeholder layer (between content and IMA)");
4843
+ console.log("[StormcloudVideoPlayer] Showing placeholder layer (between content and ".concat(this.getAdPlayerTypeLabel(), ")"));
4826
4844
  }
4827
4845
  }
4828
4846
  },
@@ -5534,6 +5552,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5534
5552
  return this.config.adPlayerType === "prebid";
5535
5553
  }
5536
5554
  },
5555
+ {
5556
+ key: "isLgStbDevice",
5557
+ value: function isLgStbDevice() {
5558
+ if (typeof navigator === "undefined" || !navigator.userAgent) return false;
5559
+ var ua = navigator.userAgent;
5560
+ return /Web0S|webOS|LG Browser|LGSTB/i.test(ua);
5561
+ }
5562
+ },
5537
5563
  {
5538
5564
  key: "getCurrentAdIndex",
5539
5565
  value: function getCurrentAdIndex() {
@@ -6348,15 +6374,34 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6348
6374
  key: "continuousFetchLoop",
6349
6375
  value: function continuousFetchLoop(baseVastUrl) {
6350
6376
  return _async_to_generator(function() {
6351
- var _this, _loop, _ret;
6377
+ var loopIterations, _this, _loop, _ret;
6352
6378
  return _ts_generator(this, function(_state) {
6353
6379
  switch(_state.label){
6354
6380
  case 0:
6381
+ loopIterations = 0;
6382
+ _state.label = 1;
6383
+ case 1:
6384
+ _state.trys.push([
6385
+ 1,
6386
+ ,
6387
+ 5,
6388
+ 6
6389
+ ]);
6355
6390
  _loop = function() {
6356
- var remaining, maxQueueSize, newAdUrl, queuedUrlsPreview, generationDelay;
6391
+ var remaining, elapsedMs, maxLoopMs, maxQueueSize, newAdUrl, queuedUrlsPreview, generationDelay;
6357
6392
  return _ts_generator(this, function(_state) {
6358
6393
  switch(_state.label){
6359
6394
  case 0:
6395
+ loopIterations++;
6396
+ if (loopIterations > _this.continuousFetchMaxIterations) {
6397
+ if (_this.config.debugAdTiming) {
6398
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Max iterations reached (".concat(_this.continuousFetchMaxIterations, "), stopping URL generation"));
6399
+ }
6400
+ return [
6401
+ 2,
6402
+ "break"
6403
+ ];
6404
+ }
6360
6405
  remaining = _this.getRemainingAdMs();
6361
6406
  if (remaining <= 0) {
6362
6407
  if (_this.config.debugAdTiming) {
@@ -6367,6 +6412,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6367
6412
  "break"
6368
6413
  ];
6369
6414
  }
6415
+ if (_this.currentAdBreakStartWallClockMs != null && _this.expectedAdBreakDurationMs != null) {
6416
+ elapsedMs = Date.now() - _this.currentAdBreakStartWallClockMs;
6417
+ maxLoopMs = _this.expectedAdBreakDurationMs + _this.continuousFetchWallClockBufferMs;
6418
+ if (elapsedMs >= maxLoopMs) {
6419
+ if (_this.config.debugAdTiming) {
6420
+ console.log("[CONTINUOUS-FETCH] ⏹️ Wall-clock limit reached (".concat(elapsedMs, "ms >= ").concat(maxLoopMs, "ms), stopping URL generation"));
6421
+ }
6422
+ return [
6423
+ 2,
6424
+ "break"
6425
+ ];
6426
+ }
6427
+ }
6370
6428
  if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
6371
6429
  if (_this.config.debugAdTiming) {
6372
6430
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
@@ -6388,46 +6446,63 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6388
6446
  maxQueueSize = 5;
6389
6447
  if (!(_this.adRequestQueue.length >= maxQueueSize)) return [
6390
6448
  3,
6391
- 2
6449
+ 4
6450
+ ];
6451
+ if (!(_this.isPrebidMode() && _this.isLgStbDevice())) return [
6452
+ 3,
6453
+ 1
6392
6454
  ];
6455
+ _this.adRequestQueue.shift();
6456
+ _this.adRequestQueue.push("");
6457
+ _this.totalAdsInBreak++;
6458
+ _this.continuousFetchQueueFullConsecutiveWaits = 0;
6393
6459
  if (_this.config.debugAdTiming) {
6394
- console.log("[CONTINUOUS-FETCH] ⏸️ URL queue full (".concat(_this.adRequestQueue.length, "), waiting..."));
6460
+ console.log("[CONTINUOUS-FETCH] Prebid slot rotated (queue full, dropped oldest); queue: ".concat(_this.adRequestQueue.length));
6395
6461
  }
6396
6462
  return [
6397
- 4,
6398
- new Promise(function(resolve) {
6399
- return setTimeout(resolve, 1e3);
6400
- })
6463
+ 3,
6464
+ 3
6401
6465
  ];
6402
6466
  case 1:
6467
+ return [
6468
+ 4,
6469
+ _this.waitForQueueWithBackoff()
6470
+ ];
6471
+ case 2:
6403
6472
  _state.sent();
6404
6473
  return [
6405
6474
  2,
6406
6475
  "continue"
6407
6476
  ];
6408
- case 2:
6477
+ case 3:
6478
+ return [
6479
+ 3,
6480
+ 8
6481
+ ];
6482
+ case 4:
6409
6483
  if (!_this.isPrebidMode()) return [
6410
6484
  3,
6411
- 3
6485
+ 5
6412
6486
  ];
6413
6487
  _this.adRequestQueue.push("");
6414
6488
  _this.totalAdsInBreak++;
6489
+ _this.continuousFetchQueueFullConsecutiveWaits = 0;
6415
6490
  if (_this.config.debugAdTiming) {
6416
6491
  console.log("[CONTINUOUS-FETCH] Prebid auction slot queued (queue: ".concat(_this.adRequestQueue.length, ")"));
6417
6492
  }
6418
6493
  return [
6419
6494
  3,
6420
- 6
6495
+ 8
6421
6496
  ];
6422
- case 3:
6497
+ case 5:
6423
6498
  if (!baseVastUrl) return [
6424
6499
  3,
6425
- 6
6500
+ 8
6426
6501
  ];
6427
6502
  newAdUrl = _this.generateVastUrlsWithCorrelators(baseVastUrl, 1)[0];
6428
6503
  if (!(!newAdUrl || _this.failedVastUrls.has(newAdUrl) || _this.isUrlInCooldown(newAdUrl))) return [
6429
6504
  3,
6430
- 5
6505
+ 7
6431
6506
  ];
6432
6507
  return [
6433
6508
  4,
@@ -6435,13 +6510,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6435
6510
  return setTimeout(resolve, 500);
6436
6511
  })
6437
6512
  ];
6438
- case 4:
6513
+ case 6:
6439
6514
  _state.sent();
6440
6515
  return [
6441
6516
  2,
6442
6517
  "continue"
6443
6518
  ];
6444
- case 5:
6519
+ case 7:
6445
6520
  if (_this.config.debugAdTiming) {
6446
6521
  queuedUrlsPreview = _to_consumable_array(_this.adRequestQueue).concat([
6447
6522
  newAdUrl
@@ -6452,8 +6527,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6452
6527
  }
6453
6528
  _this.adRequestQueue.push(newAdUrl);
6454
6529
  _this.totalAdsInBreak++;
6455
- _state.label = 6;
6456
- case 6:
6530
+ _this.continuousFetchQueueFullConsecutiveWaits = 0;
6531
+ _state.label = 8;
6532
+ case 8:
6457
6533
  generationDelay = _this.consecutiveFailures > 0 ? Math.min(1e3 * Math.pow(2, _this.consecutiveFailures), 5e3) : 500;
6458
6534
  return [
6459
6535
  4,
@@ -6461,7 +6537,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6461
6537
  return setTimeout(resolve, generationDelay);
6462
6538
  })
6463
6539
  ];
6464
- case 7:
6540
+ case 9:
6465
6541
  _state.sent();
6466
6542
  return [
6467
6543
  2
@@ -6469,33 +6545,41 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6469
6545
  }
6470
6546
  });
6471
6547
  };
6472
- _state.label = 1;
6473
- case 1:
6548
+ _state.label = 2;
6549
+ case 2:
6474
6550
  if (!(this.continuousFetchingActive && this.inAdBreak)) return [
6475
6551
  3,
6476
- 3
6552
+ 4
6477
6553
  ];
6478
6554
  _this = this;
6479
6555
  return [
6480
6556
  5,
6481
6557
  _ts_values(_loop())
6482
6558
  ];
6483
- case 2:
6559
+ case 3:
6484
6560
  _ret = _state.sent();
6485
6561
  if (_ret === "break") return [
6486
6562
  3,
6487
- 3
6563
+ 4
6488
6564
  ];
6489
6565
  return [
6490
6566
  3,
6491
- 1
6567
+ 2
6492
6568
  ];
6493
- case 3:
6569
+ case 4:
6570
+ return [
6571
+ 3,
6572
+ 6
6573
+ ];
6574
+ case 5:
6494
6575
  this.continuousFetchLoopRunning = false;
6576
+ this.continuousFetchQueueFullConsecutiveWaits = 0;
6577
+ return [
6578
+ 7
6579
+ ];
6580
+ case 6:
6495
6581
  if (this.config.debugAdTiming) {
6496
- console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 URL generation loop ended (queued: ".concat(this.adRequestQueue.length, ")"), this.adRequestQueue.length > 0 ? {
6497
- queuedUrls: _to_consumable_array(this.adRequestQueue)
6498
- } : {});
6582
+ this.logQueueState("URL generation loop ended");
6499
6583
  }
6500
6584
  return [
6501
6585
  2
@@ -6505,6 +6589,51 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6505
6589
  }).call(this);
6506
6590
  }
6507
6591
  },
6592
+ {
6593
+ key: "waitForQueueWithBackoff",
6594
+ value: function waitForQueueWithBackoff() {
6595
+ return _async_to_generator(function() {
6596
+ var delayMs, shouldLog;
6597
+ return _ts_generator(this, function(_state) {
6598
+ switch(_state.label){
6599
+ case 0:
6600
+ this.continuousFetchQueueFullConsecutiveWaits++;
6601
+ delayMs = Math.min(1e3 * Math.pow(2, this.continuousFetchQueueFullConsecutiveWaits - 1), 5e3);
6602
+ shouldLog = this.config.debugAdTiming && (this.continuousFetchQueueFullConsecutiveWaits <= 2 || this.continuousFetchQueueFullConsecutiveWaits % 4 === 0);
6603
+ if (shouldLog) {
6604
+ console.log("[CONTINUOUS-FETCH] ⏸️ URL queue full (".concat(this.adRequestQueue.length, "), waiting ").concat(delayMs, "ms (wait #").concat(this.continuousFetchQueueFullConsecutiveWaits, ")"));
6605
+ }
6606
+ return [
6607
+ 4,
6608
+ new Promise(function(resolve) {
6609
+ return setTimeout(resolve, delayMs);
6610
+ })
6611
+ ];
6612
+ case 1:
6613
+ _state.sent();
6614
+ return [
6615
+ 2
6616
+ ];
6617
+ }
6618
+ });
6619
+ }).call(this);
6620
+ }
6621
+ },
6622
+ {
6623
+ key: "logQueueState",
6624
+ value: function logQueueState(reason) {
6625
+ if (!this.config.debugAdTiming) return;
6626
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 ".concat(reason), {
6627
+ queueLength: this.adRequestQueue.length,
6628
+ totalAdsInBreak: this.totalAdsInBreak,
6629
+ totalAdRequestsInBreak: this.totalAdRequestsInBreak,
6630
+ consecutiveFailures: this.consecutiveFailures,
6631
+ continuousFetchingActive: this.continuousFetchingActive,
6632
+ continuousFetchLoopRunning: this.continuousFetchLoopRunning,
6633
+ inAdBreak: this.inAdBreak
6634
+ });
6635
+ }
6636
+ },
6508
6637
  {
6509
6638
  key: "stopContinuousFetching",
6510
6639
  value: function stopContinuousFetching() {
@@ -6675,8 +6804,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6675
6804
  4
6676
6805
  ];
6677
6806
  }
6807
+ console.log("[StormcloudVideoPlayer] Requesting next ad (%s), queue remaining=%s", nextAdUrl === "" ? "Prebid" : "VAST", this.adRequestQueue.length);
6678
6808
  if (this.config.debugAdTiming) {
6679
- console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC Requesting next ad via IMA SDK (".concat(this.currentAdIndex + 1, "/").concat(this.totalAdsInBreak, ", ").concat(this.adRequestQueue.length, " remaining in queue)"));
6809
+ console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC Requesting next ad via ".concat(this.getAdPlayerTypeLabel(), " (").concat(this.currentAdIndex + 1, "/").concat(this.totalAdsInBreak, ", ").concat(this.adRequestQueue.length, " remaining in queue)"));
6680
6810
  }
6681
6811
  currentMuted1 = this.video.muted;
6682
6812
  currentVolume1 = this.video.volume;
@@ -6856,7 +6986,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6856
6986
  ];
6857
6987
  }
6858
6988
  if (this.config.debugAdTiming) {
6859
- console.log("[CONTINUOUS-FETCH] \u2705 Ad URL available, requesting via IMA SDK");
6989
+ console.log("[CONTINUOUS-FETCH] Ad URL available, requesting via ".concat(this.getAdPlayerTypeLabel()));
6860
6990
  }
6861
6991
  this.isShowingPlaceholder = false;
6862
6992
  this.ima.hidePlaceholder();
@@ -7198,7 +7328,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7198
7328
  }
7199
7329
  throw new Error("Too many consecutive failures");
7200
7330
  }
7201
- this.recreateImaController();
7331
+ this.recreateAdController();
7202
7332
  requestToken = ++this.adRequestTokenCounter;
7203
7333
  this.activeAdRequestToken = requestToken;
7204
7334
  this.startAdRequestWatchdog(requestToken);
@@ -7443,6 +7573,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7443
7573
  this.showAds = false;
7444
7574
  this.currentAdIndex = 0;
7445
7575
  this.totalAdsInBreak = 0;
7576
+ this.totalAdRequestsInBreak = 0;
7446
7577
  this.consecutiveFailures = 0;
7447
7578
  this.ima.stop().catch(function() {});
7448
7579
  var restoredMuted = this.ima.getOriginalMutedState();
@@ -7454,17 +7585,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7454
7585
  this.video.volume = restoredVolume;
7455
7586
  }
7456
7587
  if (this.shouldContinueLiveStreamDuringAds()) {
7457
- if (this.video.paused) {
7458
- var _this_video_play;
7459
- if (this.config.debugAdTiming) {
7588
+ var _this_video_play;
7589
+ if (this.config.debugAdTiming) {
7590
+ if (this.video.paused) {
7460
7591
  console.log("[StormcloudVideoPlayer] Content video paused in live mode after ads, resuming playback");
7461
- }
7462
- (_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
7463
- } else {
7464
- if (this.config.debugAdTiming) {
7592
+ } else {
7465
7593
  console.log("[StormcloudVideoPlayer] Content video already playing in live mode after ads");
7466
7594
  }
7467
7595
  }
7596
+ (_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
7468
7597
  } else if (this.video.paused) {
7469
7598
  var _this_video_play1;
7470
7599
  (_this_video_play1 = this.video.play()) === null || _this_video_play1 === void 0 ? void 0 : _this_video_play1.catch(function() {});