stormcloud-video-player 0.3.21 → 0.3.22

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.
@@ -1,5 +1,5 @@
1
1
  import { Component } from 'react';
2
- import { S as StormcloudVideoPlayerConfig } from '../types-CryTJVCC.cjs';
2
+ import { S as StormcloudVideoPlayerConfig } from '../types-Bpq0mkLY.cjs';
3
3
 
4
4
  interface HlsPlayerProps extends StormcloudVideoPlayerConfig {
5
5
  onMount?: (player: any) => void;
@@ -309,20 +309,6 @@ function _ts_generator(thisArg, body) {
309
309
  };
310
310
  }
311
311
  }
312
- function _ts_values(o) {
313
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
314
- if (m) return m.call(o);
315
- if (o && typeof o.length === "number") return {
316
- next: function() {
317
- if (o && i >= o.length) o = void 0;
318
- return {
319
- value: o && o[i++],
320
- done: !o
321
- };
322
- }
323
- };
324
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
325
- }
326
312
  var __create = Object.create;
327
313
  var __defProp = Object.defineProperty;
328
314
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -595,8 +581,6 @@ function createImaController(video, options) {
595
581
  var originalMutedState = false;
596
582
  var originalVolume = typeof video.volume === "number" && !Number.isNaN(video.volume) ? Math.max(0, Math.min(1, video.volume)) : 1;
597
583
  var listeners = /* @__PURE__ */ new Map();
598
- var preloadedVast = /* @__PURE__ */ new Map();
599
- var preloadingVast = /* @__PURE__ */ new Map();
600
584
  var adVideoElement;
601
585
  function setAdPlayingFlag(isPlaying) {
602
586
  if (isPlaying) {
@@ -746,15 +730,8 @@ function createImaController(video, options) {
746
730
  var adsLoadedReject;
747
731
  function makeAdsRequest(google, vastTagUrl) {
748
732
  var adsRequest = new google.ima.AdsRequest();
749
- var preloadedXml = preloadedVast.get(vastTagUrl);
750
- if (preloadedXml) {
751
- console.log("[IMA] \uD83D\uDCE6 Using preloaded VAST response");
752
- adsRequest.adsResponse = preloadedXml;
753
- preloadedVast.delete(vastTagUrl);
754
- } else {
755
- console.log("[IMA] \uD83D\uDCE1 Requesting VAST from URL (letting IMA fetch fresh)");
756
- adsRequest.adTagUrl = vastTagUrl;
757
- }
733
+ console.log("[IMA] \uD83D\uDCE1 Requesting VAST via IMA SDK:", vastTagUrl.substring(0, 80) + "...");
734
+ adsRequest.adTagUrl = vastTagUrl;
758
735
  var videoWidth = video.offsetWidth || video.clientWidth || 640;
759
736
  var videoHeight = video.offsetHeight || video.clientHeight || 480;
760
737
  adsRequest.linearAdSlotWidth = videoWidth;
@@ -802,36 +779,6 @@ function createImaController(video, options) {
802
779
  (_video_parentElement = video.parentElement) === null || _video_parentElement === void 0 ? void 0 : _video_parentElement.appendChild(container);
803
780
  adContainerEl = container;
804
781
  }
805
- function fetchVastDocument(vastTagUrl) {
806
- return _async_to_generator(function() {
807
- var response;
808
- return _ts_generator(this, function(_state) {
809
- switch(_state.label){
810
- case 0:
811
- return [
812
- 4,
813
- fetch(vastTagUrl, {
814
- mode: "cors",
815
- credentials: "include",
816
- headers: {
817
- "Accept": "application/xml, text/xml, */*"
818
- },
819
- referrerPolicy: "no-referrer-when-downgrade"
820
- })
821
- ];
822
- case 1:
823
- response = _state.sent();
824
- if (!response.ok) {
825
- throw new Error("Failed to preload VAST: ".concat(response.status));
826
- }
827
- return [
828
- 2,
829
- response.text()
830
- ];
831
- }
832
- });
833
- })();
834
- }
835
782
  function destroyAdsManager() {
836
783
  if (adsManager) {
837
784
  try {
@@ -1146,47 +1093,6 @@ function createImaController(video, options) {
1146
1093
  });
1147
1094
  })();
1148
1095
  },
1149
- preloadAds: function preloadAds(vastTagUrl) {
1150
- return _async_to_generator(function() {
1151
- var inflight, preloadPromise;
1152
- return _ts_generator(this, function(_state) {
1153
- if (!vastTagUrl || vastTagUrl.trim() === "") {
1154
- return [
1155
- 2,
1156
- Promise.resolve()
1157
- ];
1158
- }
1159
- if (preloadedVast.has(vastTagUrl)) {
1160
- return [
1161
- 2,
1162
- Promise.resolve()
1163
- ];
1164
- }
1165
- inflight = preloadingVast.get(vastTagUrl);
1166
- if (inflight) {
1167
- return [
1168
- 2,
1169
- inflight
1170
- ];
1171
- }
1172
- preloadPromise = fetchVastDocument(vastTagUrl).then(function(xml) {
1173
- preloadedVast.set(vastTagUrl, xml);
1174
- }).catch(function() {
1175
- preloadedVast.delete(vastTagUrl);
1176
- }).finally(function() {
1177
- preloadingVast.delete(vastTagUrl);
1178
- });
1179
- preloadingVast.set(vastTagUrl, preloadPromise);
1180
- return [
1181
- 2,
1182
- preloadPromise
1183
- ];
1184
- });
1185
- })();
1186
- },
1187
- hasPreloadedAd: function hasPreloadedAd(vastTagUrl) {
1188
- return preloadedVast.has(vastTagUrl);
1189
- },
1190
1096
  play: function play() {
1191
1097
  return _async_to_generator(function() {
1192
1098
  var _window_google, width, height, adVolume, _video_play;
@@ -1295,8 +1201,6 @@ function createImaController(video, options) {
1295
1201
  adDisplayContainer = void 0;
1296
1202
  adsLoader = void 0;
1297
1203
  contentVideoHidden = false;
1298
- preloadedVast.clear();
1299
- preloadingVast.clear();
1300
1204
  },
1301
1205
  isAdPlaying: function isAdPlaying() {
1302
1206
  return adPlaying;
@@ -1897,51 +1801,6 @@ function createHlsAdPlayer(contentVideo, options) {
1897
1801
  });
1898
1802
  })();
1899
1803
  },
1900
- preloadAds: function preloadAds(vastTagUrl) {
1901
- return _async_to_generator(function() {
1902
- var inflight, preloadPromise;
1903
- return _ts_generator(this, function(_state) {
1904
- if (!vastTagUrl || vastTagUrl.trim() === "") {
1905
- return [
1906
- 2,
1907
- Promise.resolve()
1908
- ];
1909
- }
1910
- if (preloadedAds.has(vastTagUrl)) {
1911
- return [
1912
- 2,
1913
- Promise.resolve()
1914
- ];
1915
- }
1916
- inflight = preloadingAds.get(vastTagUrl);
1917
- if (inflight) {
1918
- return [
1919
- 2,
1920
- inflight
1921
- ];
1922
- }
1923
- preloadPromise = fetchAndParseVastAd(vastTagUrl).then(function(ad) {
1924
- if (ad) {
1925
- preloadedAds.set(vastTagUrl, ad);
1926
- console.log("[HlsAdPlayer] Cached VAST response for preloading:", vastTagUrl);
1927
- }
1928
- }).catch(function(error) {
1929
- console.warn("[HlsAdPlayer] Failed to preload VAST response:", error);
1930
- preloadedAds.delete(vastTagUrl);
1931
- }).finally(function() {
1932
- preloadingAds.delete(vastTagUrl);
1933
- });
1934
- preloadingAds.set(vastTagUrl, preloadPromise);
1935
- return [
1936
- 2,
1937
- preloadPromise
1938
- ];
1939
- });
1940
- })();
1941
- },
1942
- hasPreloadedAd: function hasPreloadedAd(vastTagUrl) {
1943
- return preloadedAds.has(vastTagUrl);
1944
- },
1945
1804
  play: function play() {
1946
1805
  return _async_to_generator(function() {
1947
1806
  var contentVolume, adVolume, mediaFile;
@@ -2840,17 +2699,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2840
2699
  this.failedVastUrls = /* @__PURE__ */ new Set();
2841
2700
  this.continuousFetchingActive = false;
2842
2701
  this.adRequestQueue = [];
2843
- this.successfulAdRequests = [];
2844
2702
  this.maxPlaceholderDurationMs = 5e3;
2845
- this.placeholderStartTimeMs = null;
2846
2703
  this.isShowingPlaceholder = false;
2847
- this.consecutiveEmptyResponses = 0;
2848
2704
  this.totalAdRequestsInBreak = 0;
2849
- this.lastEmptyResponseTimeMs = 0;
2850
2705
  this.maxTotalAdRequestsPerBreak = 20;
2851
- this.maxConsecutiveEmptyResponses = 5;
2852
- this.baseEmptyResponseDelayMs = 2e3;
2853
- this.maxEmptyResponseDelayMs = 3e4;
2854
2706
  initializePolyfills();
2855
2707
  var browserOverrides = getBrowserConfigOverrides();
2856
2708
  this.config = _object_spread({}, config, browserOverrides);
@@ -4095,13 +3947,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4095
3947
  }
4096
3948
  this.failedVastUrls.clear();
4097
3949
  this.adRequestQueue = [];
4098
- this.successfulAdRequests = [];
4099
3950
  this.continuousFetchingActive = true;
4100
3951
  this.isShowingPlaceholder = false;
4101
- this.placeholderStartTimeMs = null;
4102
- this.consecutiveEmptyResponses = 0;
4103
3952
  this.totalAdRequestsInBreak = 0;
4104
- this.lastEmptyResponseTimeMs = 0;
4105
3953
  currentMuted = this.video.muted;
4106
3954
  currentVolume = this.video.volume;
4107
3955
  this.ima.updateOriginalMutedState(currentMuted, currentVolume);
@@ -4147,7 +3995,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4147
3995
  if (this.config.debugAdTiming) {
4148
3996
  console.log("[CONTINUOUS-FETCH] \u2705 First ad request successful, starting playback");
4149
3997
  }
4150
- this.successfulAdRequests.push(firstAdUrl);
4151
3998
  this.currentAdIndex++;
4152
3999
  this.startContinuousFetching(baseVastUrl);
4153
4000
  return [
@@ -4197,200 +4044,92 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4197
4044
  key: "continuousFetchLoop",
4198
4045
  value: function continuousFetchLoop(baseVastUrl) {
4199
4046
  return _async_to_generator(function() {
4200
- var _this, _loop, _ret;
4047
+ var remaining, maxQueueSize, newAdUrl;
4201
4048
  return _ts_generator(this, function(_state) {
4202
4049
  switch(_state.label){
4203
4050
  case 0:
4204
- _loop = function() {
4205
- var remaining, maxQueueSize, newAdUrl, _this_ima_hasPreloadedAd, _this_ima, _this_ima_hasPreloadedAd1, hasPreloadedAd, backoffDelay, error, backoffDelay1;
4206
- return _ts_generator(this, function(_state) {
4207
- switch(_state.label){
4208
- case 0:
4209
- remaining = _this.getRemainingAdMs();
4210
- if (remaining <= 0) {
4211
- if (_this.config.debugAdTiming) {
4212
- console.log("[CONTINUOUS-FETCH] \u23F9\uFE0F Ad break time expired, stopping fetch loop");
4213
- }
4214
- return [
4215
- 2,
4216
- "break"
4217
- ];
4218
- }
4219
- if (_this.totalAdRequestsInBreak >= _this.maxTotalAdRequestsPerBreak) {
4220
- if (_this.config.debugAdTiming) {
4221
- console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Maximum ad requests reached (".concat(_this.maxTotalAdRequestsPerBreak, "), stopping fetch loop to prevent server blocks"));
4222
- }
4223
- return [
4224
- 2,
4225
- "break"
4226
- ];
4227
- }
4228
- if (_this.consecutiveEmptyResponses >= _this.maxConsecutiveEmptyResponses) {
4229
- if (_this.config.debugAdTiming) {
4230
- console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive empty responses (".concat(_this.maxConsecutiveEmptyResponses, "), stopping fetch loop"));
4231
- }
4232
- return [
4233
- 2,
4234
- "break"
4235
- ];
4236
- }
4237
- maxQueueSize = 3;
4238
- if (!(_this.adRequestQueue.length >= maxQueueSize)) return [
4239
- 3,
4240
- 2
4241
- ];
4242
- if (_this.config.debugAdTiming) {
4243
- console.log("[CONTINUOUS-FETCH] ⏸️ Queue full (".concat(_this.adRequestQueue.length, "), pausing fetching..."));
4244
- }
4245
- return [
4246
- 4,
4247
- new Promise(function(resolve) {
4248
- return setTimeout(resolve, 2e3);
4249
- })
4250
- ];
4251
- case 1:
4252
- _state.sent();
4253
- return [
4254
- 2,
4255
- "continue"
4256
- ];
4257
- case 2:
4258
- newAdUrl = _this.generateVastUrlsWithCorrelators(baseVastUrl, 1)[0];
4259
- if (!(!newAdUrl || _this.failedVastUrls.has(newAdUrl))) return [
4260
- 3,
4261
- 4
4262
- ];
4263
- return [
4264
- 4,
4265
- new Promise(function(resolve) {
4266
- return setTimeout(resolve, 1e3);
4267
- })
4268
- ];
4269
- case 3:
4270
- _state.sent();
4271
- return [
4272
- 2,
4273
- "continue"
4274
- ];
4275
- case 4:
4276
- _this.totalAdRequestsInBreak++;
4277
- if (_this.config.debugAdTiming) {
4278
- console.log("[CONTINUOUS-FETCH] \uD83D\uDCE1 Attempting to fetch ad (request ".concat(_this.totalAdRequestsInBreak, "/").concat(_this.maxTotalAdRequestsPerBreak, ", queue: ").concat(_this.adRequestQueue.length, ")..."));
4279
- }
4280
- _state.label = 5;
4281
- case 5:
4282
- _state.trys.push([
4283
- 5,
4284
- 11,
4285
- ,
4286
- 13
4287
- ]);
4288
- if (!_this.ima.preloadAds) return [
4289
- 3,
4290
- 7
4291
- ];
4292
- return [
4293
- 4,
4294
- _this.ima.preloadAds(newAdUrl)
4295
- ];
4296
- case 6:
4297
- _state.sent();
4298
- _state.label = 7;
4299
- case 7:
4300
- hasPreloadedAd = (_this_ima_hasPreloadedAd1 = (_this_ima_hasPreloadedAd = (_this_ima = _this.ima).hasPreloadedAd) === null || _this_ima_hasPreloadedAd === void 0 ? void 0 : _this_ima_hasPreloadedAd.call(_this_ima, newAdUrl)) !== null && _this_ima_hasPreloadedAd1 !== void 0 ? _this_ima_hasPreloadedAd1 : false;
4301
- if (!!hasPreloadedAd) return [
4302
- 3,
4303
- 9
4304
- ];
4305
- _this.consecutiveEmptyResponses++;
4306
- _this.lastEmptyResponseTimeMs = Date.now();
4307
- backoffDelay = Math.min(_this.baseEmptyResponseDelayMs * Math.pow(2, _this.consecutiveEmptyResponses - 1), _this.maxEmptyResponseDelayMs);
4308
- if (_this.config.debugAdTiming) {
4309
- console.log("[CONTINUOUS-FETCH] ⚠️ Empty/invalid VAST response (".concat(_this.consecutiveEmptyResponses, "/").concat(_this.maxConsecutiveEmptyResponses, " consecutive), backing off for ").concat(backoffDelay, "ms"));
4310
- }
4311
- _this.failedVastUrls.add(newAdUrl);
4312
- return [
4313
- 4,
4314
- new Promise(function(resolve) {
4315
- return setTimeout(resolve, backoffDelay);
4316
- })
4317
- ];
4318
- case 8:
4319
- _state.sent();
4320
- return [
4321
- 2,
4322
- "continue"
4323
- ];
4324
- case 9:
4325
- _this.consecutiveEmptyResponses = 0;
4326
- if (_this.config.debugAdTiming) {
4327
- console.log("[CONTINUOUS-FETCH] ✅ Successfully preloaded ad, adding to queue (queue size: ".concat(_this.adRequestQueue.length + 1, ")"));
4328
- }
4329
- _this.adRequestQueue.push(newAdUrl);
4330
- _this.totalAdsInBreak++;
4331
- return [
4332
- 4,
4333
- new Promise(function(resolve) {
4334
- return setTimeout(resolve, 500);
4335
- })
4336
- ];
4337
- case 10:
4338
- _state.sent();
4339
- return [
4340
- 3,
4341
- 13
4342
- ];
4343
- case 11:
4344
- error = _state.sent();
4345
- if (_this.config.debugAdTiming) {
4346
- console.log("[CONTINUOUS-FETCH] \u274C Ad preload failed:", error.message);
4347
- }
4348
- _this.failedVastUrls.add(newAdUrl);
4349
- _this.consecutiveEmptyResponses++;
4350
- backoffDelay1 = Math.min(_this.baseEmptyResponseDelayMs * Math.pow(2, _this.consecutiveEmptyResponses - 1), _this.maxEmptyResponseDelayMs);
4351
- return [
4352
- 4,
4353
- new Promise(function(resolve) {
4354
- return setTimeout(resolve, backoffDelay1);
4355
- })
4356
- ];
4357
- case 12:
4358
- _state.sent();
4359
- return [
4360
- 3,
4361
- 13
4362
- ];
4363
- case 13:
4364
- return [
4365
- 2
4366
- ];
4367
- }
4368
- });
4369
- };
4370
- _state.label = 1;
4371
- case 1:
4372
4051
  if (!(this.continuousFetchingActive && this.inAdBreak)) return [
4373
4052
  3,
4374
- 3
4053
+ 6
4375
4054
  ];
4376
- _this = this;
4055
+ remaining = this.getRemainingAdMs();
4056
+ if (remaining <= 0) {
4057
+ if (this.config.debugAdTiming) {
4058
+ console.log("[CONTINUOUS-FETCH] \u23F9\uFE0F Ad break time expired, stopping URL generation");
4059
+ }
4060
+ return [
4061
+ 3,
4062
+ 6
4063
+ ];
4064
+ }
4065
+ if (this.totalAdRequestsInBreak >= this.maxTotalAdRequestsPerBreak) {
4066
+ if (this.config.debugAdTiming) {
4067
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Maximum ad requests reached (".concat(this.maxTotalAdRequestsPerBreak, "), stopping"));
4068
+ }
4069
+ return [
4070
+ 3,
4071
+ 6
4072
+ ];
4073
+ }
4074
+ maxQueueSize = 5;
4075
+ if (!(this.adRequestQueue.length >= maxQueueSize)) return [
4076
+ 3,
4077
+ 2
4078
+ ];
4079
+ if (this.config.debugAdTiming) {
4080
+ console.log("[CONTINUOUS-FETCH] ⏸️ URL queue full (".concat(this.adRequestQueue.length, "), waiting..."));
4081
+ }
4377
4082
  return [
4378
- 5,
4379
- _ts_values(_loop())
4083
+ 4,
4084
+ new Promise(function(resolve) {
4085
+ return setTimeout(resolve, 1e3);
4086
+ })
4087
+ ];
4088
+ case 1:
4089
+ _state.sent();
4090
+ return [
4091
+ 3,
4092
+ 0
4380
4093
  ];
4381
4094
  case 2:
4382
- _ret = _state.sent();
4383
- if (_ret === "break") return [
4095
+ newAdUrl = this.generateVastUrlsWithCorrelators(baseVastUrl, 1)[0];
4096
+ if (!(!newAdUrl || this.failedVastUrls.has(newAdUrl))) return [
4384
4097
  3,
4385
- 3
4098
+ 4
4386
4099
  ];
4387
4100
  return [
4388
- 3,
4389
- 1
4101
+ 4,
4102
+ new Promise(function(resolve) {
4103
+ return setTimeout(resolve, 500);
4104
+ })
4390
4105
  ];
4391
4106
  case 3:
4107
+ _state.sent();
4108
+ return [
4109
+ 3,
4110
+ 0
4111
+ ];
4112
+ case 4:
4113
+ if (this.config.debugAdTiming) {
4114
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDCDD Queued VAST URL (queue size: ".concat(this.adRequestQueue.length + 1, ")"));
4115
+ }
4116
+ this.adRequestQueue.push(newAdUrl);
4117
+ this.totalAdsInBreak++;
4118
+ return [
4119
+ 4,
4120
+ new Promise(function(resolve) {
4121
+ return setTimeout(resolve, 300);
4122
+ })
4123
+ ];
4124
+ case 5:
4125
+ _state.sent();
4126
+ return [
4127
+ 3,
4128
+ 0
4129
+ ];
4130
+ case 6:
4392
4131
  if (this.config.debugAdTiming) {
4393
- console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Continuous fetch loop ended (total requests: ".concat(this.totalAdRequestsInBreak, ", empty responses: ").concat(this.consecutiveEmptyResponses, ")"));
4132
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 URL generation loop ended (queued: ".concat(this.adRequestQueue.length, ")"));
4394
4133
  }
4395
4134
  return [
4396
4135
  2
@@ -4439,19 +4178,20 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4439
4178
  2
4440
4179
  ];
4441
4180
  if (this.config.debugAdTiming) {
4442
- console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC Playing next queued ad (".concat(this.currentAdIndex + 1, "/").concat(this.totalAdsInBreak, ", ").concat(this.adRequestQueue.length, " remaining in queue)"));
4181
+ 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)"));
4443
4182
  }
4444
4183
  currentMuted = this.video.muted;
4445
4184
  currentVolume = this.video.volume;
4446
4185
  this.ima.updateOriginalMutedState(currentMuted, currentVolume);
4447
- if (this.config.debugAdTiming) {
4448
- console.log("[CONTINUOUS-FETCH] \uD83D\uDD0A Updated ad audio state: muted=".concat(currentMuted, ", volume=").concat(currentVolume));
4449
- }
4450
4186
  this.currentAdIndex++;
4451
- this.successfulAdRequests.push(nextAdUrl);
4187
+ this.totalAdRequestsInBreak++;
4452
4188
  return [
4453
4189
  4,
4454
- this.playSingleAd(nextAdUrl).catch(function() {
4190
+ this.playSingleAd(nextAdUrl).catch(function(error) {
4191
+ if (_this.config.debugAdTiming) {
4192
+ console.log("[CONTINUOUS-FETCH] \u274C Ad request failed:", error.message);
4193
+ }
4194
+ _this.failedVastUrls.add(nextAdUrl);
4455
4195
  _this.tryNextAvailableAd(0);
4456
4196
  })
4457
4197
  ];
@@ -4461,18 +4201,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4461
4201
  2
4462
4202
  ];
4463
4203
  case 2:
4464
- maxRetries = 5;
4204
+ maxRetries = 3;
4465
4205
  if (!(this.continuousFetchingActive && retryCount < maxRetries && remaining > 2e3)) return [
4466
4206
  3,
4467
4207
  5
4468
4208
  ];
4469
4209
  if (this.config.debugAdTiming) {
4470
- console.log("[CONTINUOUS-FETCH] ⏳ Queue empty but fetching active, waiting... (retry ".concat(retryCount + 1, "/").concat(maxRetries, ")"));
4210
+ console.log("[CONTINUOUS-FETCH] ⏳ Queue empty, waiting for URLs... (".concat(retryCount + 1, "/").concat(maxRetries, ")"));
4471
4211
  }
4472
4212
  return [
4473
4213
  4,
4474
4214
  new Promise(function(resolve) {
4475
- return setTimeout(resolve, 1e3);
4215
+ return setTimeout(resolve, 500);
4476
4216
  })
4477
4217
  ];
4478
4218
  case 3:
@@ -4521,12 +4261,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4521
4261
  ];
4522
4262
  }
4523
4263
  if (this.config.debugAdTiming) {
4524
- console.log("[CONTINUOUS-FETCH] ⬛ Showing black placeholder for ".concat(waitTime, "ms while waiting for ads"));
4264
+ console.log("[CONTINUOUS-FETCH] ⬛ Showing placeholder for ".concat(waitTime, "ms while waiting for ad URLs"));
4525
4265
  }
4526
4266
  this.isShowingPlaceholder = true;
4527
- this.placeholderStartTimeMs = Date.now();
4528
4267
  this.ima.showPlaceholder();
4529
- checkInterval = 500;
4268
+ checkInterval = 300;
4530
4269
  maxChecks = Math.floor(waitTime / checkInterval);
4531
4270
  i = 0;
4532
4271
  _state.label = 1;
@@ -4553,10 +4292,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4553
4292
  5
4554
4293
  ];
4555
4294
  if (this.config.debugAdTiming) {
4556
- console.log("[CONTINUOUS-FETCH] \u2705 New ad became available during placeholder");
4295
+ console.log("[CONTINUOUS-FETCH] \u2705 Ad URL available, requesting via IMA SDK");
4557
4296
  }
4558
4297
  this.isShowingPlaceholder = false;
4559
- this.placeholderStartTimeMs = null;
4560
4298
  this.ima.hidePlaceholder();
4561
4299
  currentMuted = this.video.muted;
4562
4300
  currentVolume = this.video.volume;
@@ -4567,7 +4305,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4567
4305
  4
4568
4306
  ];
4569
4307
  this.currentAdIndex++;
4570
- this.successfulAdRequests.push(nextAdUrl);
4308
+ this.totalAdRequestsInBreak++;
4571
4309
  return [
4572
4310
  4,
4573
4311
  this.playSingleAd(nextAdUrl).catch(function() {
@@ -4589,10 +4327,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4589
4327
  ];
4590
4328
  case 6:
4591
4329
  if (this.config.debugAdTiming) {
4592
- console.log("[CONTINUOUS-FETCH] \u23F0 Placeholder timeout reached, no ads fetched");
4330
+ console.log("[CONTINUOUS-FETCH] \u23F0 Placeholder timeout, ending ad break");
4593
4331
  }
4594
4332
  this.isShowingPlaceholder = false;
4595
- this.placeholderStartTimeMs = null;
4596
4333
  this.ima.hidePlaceholder();
4597
4334
  this.handleAdPodComplete();
4598
4335
  return [
@@ -4894,10 +4631,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4894
4631
  if (this.isShowingPlaceholder) {
4895
4632
  this.ima.hidePlaceholder();
4896
4633
  this.isShowingPlaceholder = false;
4897
- this.placeholderStartTimeMs = null;
4898
4634
  }
4899
4635
  this.adRequestQueue = [];
4900
- this.successfulAdRequests = [];
4901
4636
  this.inAdBreak = false;
4902
4637
  this.expectedAdBreakDurationMs = void 0;
4903
4638
  this.currentAdBreakStartWallClockMs = void 0;
@@ -5276,7 +5011,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5276
5011
  (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
5277
5012
  (_this_ima = this.ima) === null || _this_ima === void 0 ? void 0 : _this_ima.destroy();
5278
5013
  this.adRequestQueue = [];
5279
- this.successfulAdRequests = [];
5280
5014
  }
5281
5015
  }
5282
5016
  ]);