stormcloud-video-player 0.5.3 → 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.
@@ -227,9 +227,17 @@ function _ts_generator(thisArg, body) {
227
227
  },
228
228
  trys: [],
229
229
  ops: []
230
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
231
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
232
- return this;
230
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
231
+ return d(g, "next", {
232
+ value: verb(0)
233
+ }), d(g, "throw", {
234
+ value: verb(1)
235
+ }), d(g, "return", {
236
+ value: verb(2)
237
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
238
+ value: function() {
239
+ return this;
240
+ }
233
241
  }), g;
234
242
  function verb(n) {
235
243
  return function(v) {
@@ -329,20 +337,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
329
337
  var __getOwnPropNames = Object.getOwnPropertyNames;
330
338
  var __getProtoOf = Object.getPrototypeOf;
331
339
  var __hasOwnProp = Object.prototype.hasOwnProperty;
332
- var __export = function(target, all) {
340
+ var __export = function __export(target, all) {
333
341
  for(var name in all)__defProp(target, name, {
334
342
  get: all[name],
335
343
  enumerable: true
336
344
  });
337
345
  };
338
- var __copyProps = function(to, from, except, desc) {
346
+ var __copyProps = function __copyProps(to, from, except, desc) {
339
347
  if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
340
348
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
341
349
  try {
342
350
  var _loop = function() {
343
351
  var key = _step.value;
344
352
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
345
- get: function() {
353
+ get: function get() {
346
354
  return from[key];
347
355
  },
348
356
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -366,7 +374,7 @@ var __copyProps = function(to, from, except, desc) {
366
374
  }
367
375
  return to;
368
376
  };
369
- var __toESM = function(mod, isNodeMode, target) {
377
+ var __toESM = function __toESM(mod, isNodeMode, target) {
370
378
  return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
371
379
  // file that has been converted to a CommonJS file using a Babel-
372
380
  // compatible transform (i.e. "__esModule" has not been set), then set
@@ -376,7 +384,7 @@ var __toESM = function(mod, isNodeMode, target) {
376
384
  enumerable: true
377
385
  }) : target, mod);
378
386
  };
379
- var __toCommonJS = function(mod) {
387
+ var __toCommonJS = function __toCommonJS(mod) {
380
388
  return __copyProps(__defProp({}, "__esModule", {
381
389
  value: true
382
390
  }), mod);
@@ -384,7 +392,7 @@ var __toCommonJS = function(mod) {
384
392
  // src/players/HlsPlayer.tsx
385
393
  var HlsPlayer_exports = {};
386
394
  __export(HlsPlayer_exports, {
387
- default: function() {
395
+ default: function _default() {
388
396
  return HlsPlayer;
389
397
  }
390
398
  });
@@ -719,7 +727,7 @@ function createImaController(video, options) {
719
727
  var fn = _step.value;
720
728
  try {
721
729
  fn(payload);
722
- } catch (e) {}
730
+ } catch (unused) {}
723
731
  }
724
732
  } catch (err) {
725
733
  _didIteratorError = true;
@@ -757,7 +765,7 @@ function createImaController(video, options) {
757
765
  console.error("StormcloudVideoPlayer: The host page is inside a sandboxed iframe without 'allow-scripts'. Google IMA cannot run ads within sandboxed frames. Remove the sandbox attribute or include 'allow-scripts allow-same-origin'.");
758
766
  }
759
767
  }
760
- } catch (e) {}
768
+ } catch (unused) {}
761
769
  if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
762
770
  var existing = document.querySelector('script[data-ima="true"]');
763
771
  if (existing) {
@@ -1005,7 +1013,7 @@ function createImaController(video, options) {
1005
1013
  if (adsManager) {
1006
1014
  try {
1007
1015
  adsManager.destroy();
1008
- } catch (e) {}
1016
+ } catch (unused) {}
1009
1017
  adsManager = void 0;
1010
1018
  }
1011
1019
  if (adVideoElement) {
@@ -1016,7 +1024,7 @@ function createImaController(video, options) {
1016
1024
  if (adsLoader) {
1017
1025
  try {
1018
1026
  adsLoader.destroy();
1019
- } catch (e) {}
1027
+ } catch (unused) {}
1020
1028
  adsLoader = void 0;
1021
1029
  }
1022
1030
  }
@@ -1034,7 +1042,7 @@ function createImaController(video, options) {
1034
1042
  try {
1035
1043
  var _adDisplayContainer_initialize;
1036
1044
  (_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
1037
- } catch (e) {}
1045
+ } catch (unused) {}
1038
1046
  }
1039
1047
  }).catch(function() {});
1040
1048
  },
@@ -1193,7 +1201,7 @@ function createImaController(video, options) {
1193
1201
  window.setTimeout(function() {
1194
1202
  try {
1195
1203
  makeAdsRequest(google, lastAdTagUrl);
1196
- } catch (e) {}
1204
+ } catch (unused) {}
1197
1205
  }, delay);
1198
1206
  } else {
1199
1207
  emit("ad_error", {
@@ -1225,7 +1233,7 @@ function createImaController(video, options) {
1225
1233
  if (adsManager) {
1226
1234
  try {
1227
1235
  adsManager.setVolume(adVolume);
1228
- } catch (e) {}
1236
+ } catch (unused) {}
1229
1237
  }
1230
1238
  emit("content_pause");
1231
1239
  });
@@ -1239,7 +1247,7 @@ function createImaController(video, options) {
1239
1247
  if (adsManager) {
1240
1248
  try {
1241
1249
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1242
- } catch (e) {}
1250
+ } catch (unused) {}
1243
1251
  }
1244
1252
  }
1245
1253
  if (adContainerEl) {
@@ -1400,7 +1408,7 @@ function createImaController(video, options) {
1400
1408
  }
1401
1409
  try {
1402
1410
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1403
- } catch (e) {}
1411
+ } catch (unused) {}
1404
1412
  adsManager.start();
1405
1413
  return [
1406
1414
  2,
@@ -1482,7 +1490,7 @@ function createImaController(video, options) {
1482
1490
  try {
1483
1491
  ;
1484
1492
  adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
1485
- } catch (e) {}
1493
+ } catch (unused) {}
1486
1494
  destroyAdsManager();
1487
1495
  return [
1488
1496
  2
@@ -1513,7 +1521,7 @@ function createImaController(video, options) {
1513
1521
  try {
1514
1522
  var _adsLoader_destroy;
1515
1523
  adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
1516
- } catch (e) {}
1524
+ } catch (unused) {}
1517
1525
  adDisplayContainer = void 0;
1518
1526
  adsLoader = void 0;
1519
1527
  contentVideoHidden = false;
@@ -1562,7 +1570,7 @@ function createImaController(video, options) {
1562
1570
  if (adsManager && adPlaying) {
1563
1571
  try {
1564
1572
  adsManager.setVolume(clampedVolume);
1565
- } catch (e) {}
1573
+ } catch (unused) {}
1566
1574
  }
1567
1575
  },
1568
1576
  getAdVolume: function getAdVolume() {
@@ -2050,10 +2058,10 @@ function createHlsAdPlayer(contentVideo, options) {
2050
2058
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
2051
2059
  if (contentVideo.paused) {
2052
2060
  console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback");
2053
- contentVideo.play().catch(function() {});
2054
2061
  } else {
2055
2062
  console.log("[HlsAdPlayer] Content video already playing in live mode");
2056
2063
  }
2064
+ contentVideo.play().catch(function() {});
2057
2065
  }
2058
2066
  emit("content_resume");
2059
2067
  }
@@ -2326,8 +2334,8 @@ function createHlsAdPlayer(contentVideo, options) {
2326
2334
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
2327
2335
  if (contentVideo.paused) {
2328
2336
  console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback on stop");
2329
- contentVideo.play().catch(function() {});
2330
2337
  }
2338
+ contentVideo.play().catch(function() {});
2331
2339
  }
2332
2340
  if (adHls) {
2333
2341
  adHls.destroy();
@@ -2336,6 +2344,8 @@ function createHlsAdPlayer(contentVideo, options) {
2336
2344
  if (adVideoElement) {
2337
2345
  adVideoElement.pause();
2338
2346
  adVideoElement.src = "";
2347
+ adVideoElement.remove();
2348
+ adVideoElement = void 0;
2339
2349
  }
2340
2350
  currentAd = void 0;
2341
2351
  return [
@@ -2478,8 +2488,8 @@ var DEFAULT_TIMEOUT_MS = 3e3;
2478
2488
  var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
2479
2489
  function createPrebidManager() {
2480
2490
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2481
- var initialized = false;
2482
2491
  var _options_debug;
2492
+ var initialized = false;
2483
2493
  var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
2484
2494
  function log() {
2485
2495
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
@@ -2981,13 +2991,15 @@ function createPrebidController(contentVideo, options) {
2981
2991
  adContainerEl.style.display = "none";
2982
2992
  adContainerEl.style.pointerEvents = "none";
2983
2993
  }
2994
+ contentVideo.style.visibility = "visible";
2995
+ contentVideo.style.opacity = "1";
2984
2996
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
2985
2997
  if (contentVideo.paused) {
2986
2998
  console.log("".concat(LOG, " Content video paused in live mode, resuming playback"));
2987
- contentVideo.play().catch(function() {});
2988
2999
  } else {
2989
3000
  console.log("".concat(LOG, " Content video already playing in live mode"));
2990
3001
  }
3002
+ contentVideo.play().catch(function() {});
2991
3003
  }
2992
3004
  emit("content_resume");
2993
3005
  }
@@ -3353,8 +3365,8 @@ function createPrebidController(contentVideo, options) {
3353
3365
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
3354
3366
  if (contentVideo.paused) {
3355
3367
  console.log("".concat(LOG, " Content video paused in live mode, resuming playback on stop"));
3356
- contentVideo.play().catch(function() {});
3357
3368
  }
3369
+ contentVideo.play().catch(function() {});
3358
3370
  }
3359
3371
  if (adHls) {
3360
3372
  adHls.destroy();
@@ -3363,6 +3375,8 @@ function createPrebidController(contentVideo, options) {
3363
3375
  if (adVideoElement) {
3364
3376
  adVideoElement.pause();
3365
3377
  adVideoElement.src = "";
3378
+ adVideoElement.remove();
3379
+ adVideoElement = void 0;
3366
3380
  }
3367
3381
  currentAd = void 0;
3368
3382
  return [
@@ -4131,6 +4145,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4131
4145
  this.minAdRequestIntervalMs = 2500;
4132
4146
  this.backoffBaseMs = 1e3;
4133
4147
  this.maxBackoffMs = 15e3;
4148
+ this.continuousFetchWallClockBufferMs = 3e4;
4149
+ this.continuousFetchMaxIterations = 500;
4150
+ this.continuousFetchQueueFullConsecutiveWaits = 0;
4134
4151
  this.preloadPool = [];
4135
4152
  this.maxPreloadPoolSize = 3;
4136
4153
  this.preloadPoolActive = false;
@@ -4190,6 +4207,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4190
4207
  }
4191
4208
  }
4192
4209
  },
4210
+ {
4211
+ key: "getAdPlayerTypeLabel",
4212
+ value: function getAdPlayerTypeLabel() {
4213
+ var t = this.config.adPlayerType;
4214
+ if (t === "prebid") return "Prebid";
4215
+ if (t === "hls") return "HLS";
4216
+ return "IMA";
4217
+ }
4218
+ },
4193
4219
  {
4194
4220
  key: "load",
4195
4221
  value: function load() {
@@ -4289,7 +4315,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4289
4315
  });
4290
4316
  this.hls.on(import_hls3.default.Events.MANIFEST_PARSED, function(_, data) {
4291
4317
  return _async_to_generator(function() {
4292
- var _this_hls_levels, _this_hls, _this_hls_levels_some, adBehavior, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
4318
+ var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
4293
4319
  return _ts_generator(this, function(_state) {
4294
4320
  switch(_state.label){
4295
4321
  case 0:
@@ -4298,10 +4324,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4298
4324
  } else {
4299
4325
  ;
4300
4326
  ;
4301
- this.isLiveStream = (_this_hls_levels_some = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
4327
+ this.isLiveStream = (_ref = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
4302
4328
  var _level_details, _level_details1;
4303
4329
  return (level === null || level === void 0 ? void 0 : (_level_details = level.details) === null || _level_details === void 0 ? void 0 : _level_details.live) === true || (level === null || level === void 0 ? void 0 : (_level_details1 = level.details) === null || _level_details1 === void 0 ? void 0 : _level_details1.type) === "LIVE";
4304
- })) !== null && _this_hls_levels_some !== void 0 ? _this_hls_levels_some : false;
4330
+ })) !== null && _ref !== void 0 ? _ref : false;
4305
4331
  }
4306
4332
  if (this.config.debugAdTiming) {
4307
4333
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -4365,9 +4391,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4365
4391
  var tag = "";
4366
4392
  var value = "";
4367
4393
  if (Array.isArray(entry)) {
4368
- var _entry_;
4394
+ var _entry_, _entry_1;
4369
4395
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4370
- var _entry_1;
4371
4396
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4372
4397
  } else if (typeof entry === "string") {
4373
4398
  var idx = entry.indexOf(":");
@@ -4490,9 +4515,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4490
4515
  var tag = "";
4491
4516
  var value = "";
4492
4517
  if (Array.isArray(entry)) {
4493
- var _entry_;
4518
+ var _entry_, _entry_1;
4494
4519
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4495
- var _entry_1;
4496
4520
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4497
4521
  } else if (typeof entry === "string") {
4498
4522
  var idx = entry.indexOf(":");
@@ -4542,10 +4566,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4542
4566
  }
4543
4567
  });
4544
4568
  } else if (tag.includes("EXT-X-DATERANGE")) {
4569
+ var _attrs_CLASS;
4545
4570
  var attrs = _this.parseAttributeList(value);
4546
4571
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4547
4572
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4548
- var _attrs_CLASS;
4549
4573
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4550
4574
  var duration = _this.toNumber(attrs["DURATION"]);
4551
4575
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -4681,6 +4705,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4681
4705
  }
4682
4706
  });
4683
4707
  this.ima.on("content_resume", function() {
4708
+ console.log("[StormcloudVideoPlayer] content_resume received, inAdBreak=%s, remaining=%s", _this.inAdBreak, _this.getRemainingAdMs());
4684
4709
  if (!_this.video.muted) {
4685
4710
  _this.video.muted = true;
4686
4711
  _this.video.volume = 0;
@@ -4711,15 +4736,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4711
4736
  }
4712
4737
  },
4713
4738
  {
4714
- key: "recreateImaController",
4715
- value: function recreateImaController() {
4739
+ key: "recreateAdController",
4740
+ value: function recreateAdController() {
4741
+ var label = this.getAdPlayerTypeLabel();
4716
4742
  if (this.config.debugAdTiming) {
4717
- console.log("[StormcloudVideoPlayer] Recreating ImaController for new ad");
4743
+ console.log("[StormcloudVideoPlayer] Recreating ad controller (".concat(label, ") for new ad"));
4718
4744
  }
4719
4745
  var shouldShowPlaceholder = this.inAdBreak && this.showAds;
4720
4746
  if (shouldShowPlaceholder && this.ima) {
4721
4747
  if (this.config.debugAdTiming) {
4722
- console.log("[StormcloudVideoPlayer] Showing placeholder before destroying old ImaController");
4748
+ console.log("[StormcloudVideoPlayer] Showing placeholder before destroying old ".concat(label, " controller"));
4723
4749
  }
4724
4750
  this.showPlaceholderLayer();
4725
4751
  this.ima.showPlaceholder();
@@ -4732,7 +4758,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4732
4758
  this.video.volume = 0;
4733
4759
  } catch (error) {
4734
4760
  if (this.config.debugAdTiming) {
4735
- console.warn("[StormcloudVideoPlayer] Error destroying old ImaController:", error);
4761
+ console.warn("[StormcloudVideoPlayer] Error destroying old ".concat(label, " controller:"), error);
4736
4762
  }
4737
4763
  }
4738
4764
  }
@@ -4812,7 +4838,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4812
4838
  });
4813
4839
  }
4814
4840
  if (this.config.debugAdTiming) {
4815
- console.log("[StormcloudVideoPlayer] Showing placeholder layer (between content and IMA)");
4841
+ console.log("[StormcloudVideoPlayer] Showing placeholder layer (between content and ".concat(this.getAdPlayerTypeLabel(), ")"));
4816
4842
  }
4817
4843
  }
4818
4844
  },
@@ -4947,11 +4973,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4947
4973
  }
4948
4974
  var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
4949
4975
  if (daterangeMatch) {
4950
- var _daterangeMatch_;
4976
+ var _daterangeMatch_, _attrs_CLASS;
4951
4977
  var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
4952
4978
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4953
4979
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4954
- var _attrs_CLASS;
4955
4980
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4956
4981
  var duration = this.toNumber(attrs["DURATION"]);
4957
4982
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -5027,7 +5052,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5027
5052
  var out = "";
5028
5053
  for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
5029
5054
  return out;
5030
- } catch (e) {
5055
+ } catch (unused) {
5031
5056
  return void 0;
5032
5057
  }
5033
5058
  }
@@ -5046,6 +5071,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5046
5071
  });
5047
5072
  }
5048
5073
  if (marker.type === "start") {
5074
+ var _this_config_immediateManifestAds;
5049
5075
  var _this_pendingAdBreak;
5050
5076
  if (!this.video.muted) {
5051
5077
  this.video.muted = true;
@@ -5070,7 +5096,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5070
5096
  this.expectedAdBreakDurationMs = durationMs;
5071
5097
  this.currentAdBreakStartWallClockMs = Date.now();
5072
5098
  var isManifestMarker = this.isManifestBasedMarker(marker);
5073
- var _this_config_immediateManifestAds;
5074
5099
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
5075
5100
  if (this.config.debugAdTiming) {
5076
5101
  console.log("[StormcloudVideoPlayer] Ad start decision:", {
@@ -5225,9 +5250,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5225
5250
  var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
5226
5251
  var match;
5227
5252
  while((match = regex.exec(value)) !== null){
5228
- var _match_;
5253
+ var _match_, _ref, _match_1;
5229
5254
  var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
5230
- var _match_1, _ref;
5231
5255
  var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
5232
5256
  if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
5233
5257
  rawVal = rawVal.slice(1, -1);
@@ -5526,6 +5550,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5526
5550
  return this.config.adPlayerType === "prebid";
5527
5551
  }
5528
5552
  },
5553
+ {
5554
+ key: "isLgStbDevice",
5555
+ value: function isLgStbDevice() {
5556
+ if (typeof navigator === "undefined" || !navigator.userAgent) return false;
5557
+ var ua = navigator.userAgent;
5558
+ return /Web0S|webOS|LG Browser|LGSTB/i.test(ua);
5559
+ }
5560
+ },
5529
5561
  {
5530
5562
  key: "getCurrentAdIndex",
5531
5563
  value: function getCurrentAdIndex() {
@@ -5586,13 +5618,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5586
5618
  {
5587
5619
  key: "shouldShowNativeControls",
5588
5620
  value: function shouldShowNativeControls() {
5621
+ var _this_config_showCustomControls;
5589
5622
  var streamType = this.getStreamType();
5590
5623
  if (streamType === "other") {
5591
- var _this_config_showCustomControls;
5592
- return !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false);
5624
+ var _this_config_showCustomControls1;
5625
+ return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
5593
5626
  }
5594
- var _this_config_showCustomControls1;
5595
- return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
5627
+ return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
5596
5628
  }
5597
5629
  },
5598
5630
  {
@@ -5751,12 +5783,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5751
5783
  continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
5752
5784
  preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
5753
5785
  preloadIma.initialize();
5754
- errorListener = function(payload) {
5786
+ errorListener = function errorListener(payload) {
5755
5787
  hasAdError = true;
5756
5788
  adErrorPayload = payload;
5757
5789
  };
5758
5790
  preloadIma.on("ad_error", errorListener);
5759
- errorListenerCleanup = function() {
5791
+ errorListenerCleanup = function errorListenerCleanup() {
5760
5792
  return preloadIma.off("ad_error", errorListener);
5761
5793
  };
5762
5794
  return [
@@ -5807,7 +5839,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5807
5839
  isReady: true,
5808
5840
  loadPromise: Promise.resolve()
5809
5841
  };
5810
- lateErrorListener = function(payload) {
5842
+ lateErrorListener = function lateErrorListener(payload) {
5811
5843
  var index = _this.preloadPool.findIndex(function(entry) {
5812
5844
  return entry.vastUrl === vastUrl;
5813
5845
  });
@@ -5818,7 +5850,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5818
5850
  }
5819
5851
  try {
5820
5852
  preloadIma.destroy();
5821
- } catch (e) {}
5853
+ } catch (unused) {}
5822
5854
  }
5823
5855
  };
5824
5856
  preloadIma.on("ad_error", lateErrorListener);
@@ -6340,15 +6372,34 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6340
6372
  key: "continuousFetchLoop",
6341
6373
  value: function continuousFetchLoop(baseVastUrl) {
6342
6374
  return _async_to_generator(function() {
6343
- var _this, _loop, _ret;
6375
+ var loopIterations, _this, _loop, _ret;
6344
6376
  return _ts_generator(this, function(_state) {
6345
6377
  switch(_state.label){
6346
6378
  case 0:
6379
+ loopIterations = 0;
6380
+ _state.label = 1;
6381
+ case 1:
6382
+ _state.trys.push([
6383
+ 1,
6384
+ ,
6385
+ 5,
6386
+ 6
6387
+ ]);
6347
6388
  _loop = function() {
6348
- var remaining, maxQueueSize, newAdUrl, queuedUrlsPreview, generationDelay;
6389
+ var remaining, elapsedMs, maxLoopMs, maxQueueSize, newAdUrl, queuedUrlsPreview, generationDelay;
6349
6390
  return _ts_generator(this, function(_state) {
6350
6391
  switch(_state.label){
6351
6392
  case 0:
6393
+ loopIterations++;
6394
+ if (loopIterations > _this.continuousFetchMaxIterations) {
6395
+ if (_this.config.debugAdTiming) {
6396
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Max iterations reached (".concat(_this.continuousFetchMaxIterations, "), stopping URL generation"));
6397
+ }
6398
+ return [
6399
+ 2,
6400
+ "break"
6401
+ ];
6402
+ }
6352
6403
  remaining = _this.getRemainingAdMs();
6353
6404
  if (remaining <= 0) {
6354
6405
  if (_this.config.debugAdTiming) {
@@ -6359,6 +6410,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6359
6410
  "break"
6360
6411
  ];
6361
6412
  }
6413
+ if (_this.currentAdBreakStartWallClockMs != null && _this.expectedAdBreakDurationMs != null) {
6414
+ elapsedMs = Date.now() - _this.currentAdBreakStartWallClockMs;
6415
+ maxLoopMs = _this.expectedAdBreakDurationMs + _this.continuousFetchWallClockBufferMs;
6416
+ if (elapsedMs >= maxLoopMs) {
6417
+ if (_this.config.debugAdTiming) {
6418
+ console.log("[CONTINUOUS-FETCH] ⏹️ Wall-clock limit reached (".concat(elapsedMs, "ms >= ").concat(maxLoopMs, "ms), stopping URL generation"));
6419
+ }
6420
+ return [
6421
+ 2,
6422
+ "break"
6423
+ ];
6424
+ }
6425
+ }
6362
6426
  if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
6363
6427
  if (_this.config.debugAdTiming) {
6364
6428
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
@@ -6380,46 +6444,63 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6380
6444
  maxQueueSize = 5;
6381
6445
  if (!(_this.adRequestQueue.length >= maxQueueSize)) return [
6382
6446
  3,
6383
- 2
6447
+ 4
6448
+ ];
6449
+ if (!(_this.isPrebidMode() && _this.isLgStbDevice())) return [
6450
+ 3,
6451
+ 1
6384
6452
  ];
6453
+ _this.adRequestQueue.shift();
6454
+ _this.adRequestQueue.push("");
6455
+ _this.totalAdsInBreak++;
6456
+ _this.continuousFetchQueueFullConsecutiveWaits = 0;
6385
6457
  if (_this.config.debugAdTiming) {
6386
- console.log("[CONTINUOUS-FETCH] ⏸️ URL queue full (".concat(_this.adRequestQueue.length, "), waiting..."));
6458
+ console.log("[CONTINUOUS-FETCH] Prebid slot rotated (queue full, dropped oldest); queue: ".concat(_this.adRequestQueue.length));
6387
6459
  }
6388
6460
  return [
6389
- 4,
6390
- new Promise(function(resolve) {
6391
- return setTimeout(resolve, 1e3);
6392
- })
6461
+ 3,
6462
+ 3
6393
6463
  ];
6394
6464
  case 1:
6465
+ return [
6466
+ 4,
6467
+ _this.waitForQueueWithBackoff()
6468
+ ];
6469
+ case 2:
6395
6470
  _state.sent();
6396
6471
  return [
6397
6472
  2,
6398
6473
  "continue"
6399
6474
  ];
6400
- case 2:
6475
+ case 3:
6476
+ return [
6477
+ 3,
6478
+ 8
6479
+ ];
6480
+ case 4:
6401
6481
  if (!_this.isPrebidMode()) return [
6402
6482
  3,
6403
- 3
6483
+ 5
6404
6484
  ];
6405
6485
  _this.adRequestQueue.push("");
6406
6486
  _this.totalAdsInBreak++;
6487
+ _this.continuousFetchQueueFullConsecutiveWaits = 0;
6407
6488
  if (_this.config.debugAdTiming) {
6408
6489
  console.log("[CONTINUOUS-FETCH] Prebid auction slot queued (queue: ".concat(_this.adRequestQueue.length, ")"));
6409
6490
  }
6410
6491
  return [
6411
6492
  3,
6412
- 6
6493
+ 8
6413
6494
  ];
6414
- case 3:
6495
+ case 5:
6415
6496
  if (!baseVastUrl) return [
6416
6497
  3,
6417
- 6
6498
+ 8
6418
6499
  ];
6419
6500
  newAdUrl = _this.generateVastUrlsWithCorrelators(baseVastUrl, 1)[0];
6420
6501
  if (!(!newAdUrl || _this.failedVastUrls.has(newAdUrl) || _this.isUrlInCooldown(newAdUrl))) return [
6421
6502
  3,
6422
- 5
6503
+ 7
6423
6504
  ];
6424
6505
  return [
6425
6506
  4,
@@ -6427,13 +6508,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6427
6508
  return setTimeout(resolve, 500);
6428
6509
  })
6429
6510
  ];
6430
- case 4:
6511
+ case 6:
6431
6512
  _state.sent();
6432
6513
  return [
6433
6514
  2,
6434
6515
  "continue"
6435
6516
  ];
6436
- case 5:
6517
+ case 7:
6437
6518
  if (_this.config.debugAdTiming) {
6438
6519
  queuedUrlsPreview = _to_consumable_array(_this.adRequestQueue).concat([
6439
6520
  newAdUrl
@@ -6444,8 +6525,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6444
6525
  }
6445
6526
  _this.adRequestQueue.push(newAdUrl);
6446
6527
  _this.totalAdsInBreak++;
6447
- _state.label = 6;
6448
- case 6:
6528
+ _this.continuousFetchQueueFullConsecutiveWaits = 0;
6529
+ _state.label = 8;
6530
+ case 8:
6449
6531
  generationDelay = _this.consecutiveFailures > 0 ? Math.min(1e3 * Math.pow(2, _this.consecutiveFailures), 5e3) : 500;
6450
6532
  return [
6451
6533
  4,
@@ -6453,7 +6535,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6453
6535
  return setTimeout(resolve, generationDelay);
6454
6536
  })
6455
6537
  ];
6456
- case 7:
6538
+ case 9:
6457
6539
  _state.sent();
6458
6540
  return [
6459
6541
  2
@@ -6461,33 +6543,41 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6461
6543
  }
6462
6544
  });
6463
6545
  };
6464
- _state.label = 1;
6465
- case 1:
6546
+ _state.label = 2;
6547
+ case 2:
6466
6548
  if (!(this.continuousFetchingActive && this.inAdBreak)) return [
6467
6549
  3,
6468
- 3
6550
+ 4
6469
6551
  ];
6470
6552
  _this = this;
6471
6553
  return [
6472
6554
  5,
6473
6555
  _ts_values(_loop())
6474
6556
  ];
6475
- case 2:
6557
+ case 3:
6476
6558
  _ret = _state.sent();
6477
6559
  if (_ret === "break") return [
6478
6560
  3,
6479
- 3
6561
+ 4
6480
6562
  ];
6481
6563
  return [
6482
6564
  3,
6483
- 1
6565
+ 2
6484
6566
  ];
6485
- case 3:
6567
+ case 4:
6568
+ return [
6569
+ 3,
6570
+ 6
6571
+ ];
6572
+ case 5:
6486
6573
  this.continuousFetchLoopRunning = false;
6574
+ this.continuousFetchQueueFullConsecutiveWaits = 0;
6575
+ return [
6576
+ 7
6577
+ ];
6578
+ case 6:
6487
6579
  if (this.config.debugAdTiming) {
6488
- console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 URL generation loop ended (queued: ".concat(this.adRequestQueue.length, ")"), this.adRequestQueue.length > 0 ? {
6489
- queuedUrls: _to_consumable_array(this.adRequestQueue)
6490
- } : {});
6580
+ this.logQueueState("URL generation loop ended");
6491
6581
  }
6492
6582
  return [
6493
6583
  2
@@ -6497,6 +6587,51 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6497
6587
  }).call(this);
6498
6588
  }
6499
6589
  },
6590
+ {
6591
+ key: "waitForQueueWithBackoff",
6592
+ value: function waitForQueueWithBackoff() {
6593
+ return _async_to_generator(function() {
6594
+ var delayMs, shouldLog;
6595
+ return _ts_generator(this, function(_state) {
6596
+ switch(_state.label){
6597
+ case 0:
6598
+ this.continuousFetchQueueFullConsecutiveWaits++;
6599
+ delayMs = Math.min(1e3 * Math.pow(2, this.continuousFetchQueueFullConsecutiveWaits - 1), 5e3);
6600
+ shouldLog = this.config.debugAdTiming && (this.continuousFetchQueueFullConsecutiveWaits <= 2 || this.continuousFetchQueueFullConsecutiveWaits % 4 === 0);
6601
+ if (shouldLog) {
6602
+ console.log("[CONTINUOUS-FETCH] ⏸️ URL queue full (".concat(this.adRequestQueue.length, "), waiting ").concat(delayMs, "ms (wait #").concat(this.continuousFetchQueueFullConsecutiveWaits, ")"));
6603
+ }
6604
+ return [
6605
+ 4,
6606
+ new Promise(function(resolve) {
6607
+ return setTimeout(resolve, delayMs);
6608
+ })
6609
+ ];
6610
+ case 1:
6611
+ _state.sent();
6612
+ return [
6613
+ 2
6614
+ ];
6615
+ }
6616
+ });
6617
+ }).call(this);
6618
+ }
6619
+ },
6620
+ {
6621
+ key: "logQueueState",
6622
+ value: function logQueueState(reason) {
6623
+ if (!this.config.debugAdTiming) return;
6624
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 ".concat(reason), {
6625
+ queueLength: this.adRequestQueue.length,
6626
+ totalAdsInBreak: this.totalAdsInBreak,
6627
+ totalAdRequestsInBreak: this.totalAdRequestsInBreak,
6628
+ consecutiveFailures: this.consecutiveFailures,
6629
+ continuousFetchingActive: this.continuousFetchingActive,
6630
+ continuousFetchLoopRunning: this.continuousFetchLoopRunning,
6631
+ inAdBreak: this.inAdBreak
6632
+ });
6633
+ }
6634
+ },
6500
6635
  {
6501
6636
  key: "stopContinuousFetching",
6502
6637
  value: function stopContinuousFetching() {
@@ -6643,7 +6778,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6643
6778
  10
6644
6779
  ];
6645
6780
  nextAdUrl = this.adRequestQueue.shift();
6646
- if (!nextAdUrl) {
6781
+ if (nextAdUrl == null) {
6647
6782
  return [
6648
6783
  3,
6649
6784
  4
@@ -6667,8 +6802,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6667
6802
  4
6668
6803
  ];
6669
6804
  }
6805
+ console.log("[StormcloudVideoPlayer] Requesting next ad (%s), queue remaining=%s", nextAdUrl === "" ? "Prebid" : "VAST", this.adRequestQueue.length);
6670
6806
  if (this.config.debugAdTiming) {
6671
- 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)"));
6807
+ 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)"));
6672
6808
  }
6673
6809
  currentMuted1 = this.video.muted;
6674
6810
  currentVolume1 = this.video.volume;
@@ -6829,7 +6965,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6829
6965
  9
6830
6966
  ];
6831
6967
  nextAdUrl = this.adRequestQueue.shift();
6832
- if (!nextAdUrl) {
6968
+ if (nextAdUrl == null) {
6833
6969
  return [
6834
6970
  3,
6835
6971
  3
@@ -6848,7 +6984,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6848
6984
  ];
6849
6985
  }
6850
6986
  if (this.config.debugAdTiming) {
6851
- console.log("[CONTINUOUS-FETCH] \u2705 Ad URL available, requesting via IMA SDK");
6987
+ console.log("[CONTINUOUS-FETCH] Ad URL available, requesting via ".concat(this.getAdPlayerTypeLabel()));
6852
6988
  }
6853
6989
  this.isShowingPlaceholder = false;
6854
6990
  this.ima.hidePlaceholder();
@@ -7034,11 +7170,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7034
7170
  {
7035
7171
  key: "ensureAdStoppedByTimer",
7036
7172
  value: function ensureAdStoppedByTimer() {
7173
+ var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
7037
7174
  if (!this.inAdBreak) return;
7038
7175
  this.adStopTimerId = void 0;
7039
7176
  var adPlaying = this.ima.isAdPlaying();
7040
7177
  var pendingAds = this.adPodQueue.length > 0;
7041
- var _this_config_adBreakCheckIntervalMs;
7042
7178
  var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
7043
7179
  var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
7044
7180
  var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
@@ -7046,7 +7182,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7046
7182
  if (this.currentAdBreakStartWallClockMs != null) {
7047
7183
  elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
7048
7184
  }
7049
- var _this_expectedAdBreakDurationMs;
7050
7185
  var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
7051
7186
  var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
7052
7187
  var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
@@ -7191,7 +7326,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7191
7326
  }
7192
7327
  throw new Error("Too many consecutive failures");
7193
7328
  }
7194
- this.recreateImaController();
7329
+ this.recreateAdController();
7195
7330
  requestToken = ++this.adRequestTokenCounter;
7196
7331
  this.activeAdRequestToken = requestToken;
7197
7332
  this.startAdRequestWatchdog(requestToken);
@@ -7303,15 +7438,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7303
7438
  9
7304
7439
  ];
7305
7440
  case 9:
7306
- if (this.isTemporaryAdError(playError)) {
7307
- this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7308
- if (this.config.debugAdTiming) {
7309
- console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
7310
- }
7311
- } else {
7312
- this.failedVastUrls.add(vastTagUrl);
7313
- if (this.config.debugAdTiming) {
7314
- console.log("[AD-ERROR] Permanent play error - URL blacklisted");
7441
+ if (vastTagUrl) {
7442
+ if (this.isTemporaryAdError(playError)) {
7443
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7444
+ if (this.config.debugAdTiming) {
7445
+ console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
7446
+ }
7447
+ } else {
7448
+ this.failedVastUrls.add(vastTagUrl);
7449
+ if (this.config.debugAdTiming) {
7450
+ console.log("[AD-ERROR] Permanent play error - URL blacklisted");
7451
+ }
7315
7452
  }
7316
7453
  }
7317
7454
  this.clearAdFailsafeTimer();
@@ -7380,15 +7517,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7380
7517
  15
7381
7518
  ];
7382
7519
  case 15:
7383
- if (this.isTemporaryAdError(error)) {
7384
- this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7385
- if (this.config.debugAdTiming) {
7386
- console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
7387
- }
7388
- } else {
7389
- this.failedVastUrls.add(vastTagUrl);
7390
- if (this.config.debugAdTiming) {
7391
- console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
7520
+ if (vastTagUrl) {
7521
+ if (this.isTemporaryAdError(error)) {
7522
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7523
+ if (this.config.debugAdTiming) {
7524
+ console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
7525
+ }
7526
+ } else {
7527
+ this.failedVastUrls.add(vastTagUrl);
7528
+ if (this.config.debugAdTiming) {
7529
+ console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
7530
+ }
7392
7531
  }
7393
7532
  }
7394
7533
  this.clearAdRequestWatchdog();
@@ -7432,6 +7571,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7432
7571
  this.showAds = false;
7433
7572
  this.currentAdIndex = 0;
7434
7573
  this.totalAdsInBreak = 0;
7574
+ this.totalAdRequestsInBreak = 0;
7435
7575
  this.consecutiveFailures = 0;
7436
7576
  this.ima.stop().catch(function() {});
7437
7577
  var restoredMuted = this.ima.getOriginalMutedState();
@@ -7443,17 +7583,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7443
7583
  this.video.volume = restoredVolume;
7444
7584
  }
7445
7585
  if (this.shouldContinueLiveStreamDuringAds()) {
7446
- if (this.video.paused) {
7447
- var _this_video_play;
7448
- if (this.config.debugAdTiming) {
7586
+ var _this_video_play;
7587
+ if (this.config.debugAdTiming) {
7588
+ if (this.video.paused) {
7449
7589
  console.log("[StormcloudVideoPlayer] Content video paused in live mode after ads, resuming playback");
7450
- }
7451
- (_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
7452
- } else {
7453
- if (this.config.debugAdTiming) {
7590
+ } else {
7454
7591
  console.log("[StormcloudVideoPlayer] Content video already playing in live mode after ads");
7455
7592
  }
7456
7593
  }
7594
+ (_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
7457
7595
  } else if (this.video.paused) {
7458
7596
  var _this_video_play1;
7459
7597
  (_this_video_play1 = this.video.play()) === null || _this_video_play1 === void 0 ? void 0 : _this_video_play1.catch(function() {});
@@ -7491,8 +7629,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7491
7629
  key: "startAdRequestWatchdog",
7492
7630
  value: function startAdRequestWatchdog(token) {
7493
7631
  var _this = this;
7494
- this.clearAdRequestWatchdog();
7495
7632
  var _this_config_adFailsafeTimeoutMs;
7633
+ this.clearAdRequestWatchdog();
7496
7634
  var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7497
7635
  this.adRequestWatchdogToken = token;
7498
7636
  this.adRequestWatchdogId = window.setTimeout(function() {
@@ -7535,8 +7673,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7535
7673
  key: "startAdFailsafeTimer",
7536
7674
  value: function startAdFailsafeTimer(token) {
7537
7675
  var _this = this;
7538
- this.clearAdFailsafeTimer();
7539
7676
  var _this_config_adFailsafeTimeoutMs;
7677
+ this.clearAdFailsafeTimer();
7540
7678
  var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7541
7679
  this.adFailsafeToken = token;
7542
7680
  this.adFailsafeTimerId = window.setTimeout(function() {
@@ -7857,23 +7995,23 @@ var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
7857
7995
  var VIDEO_EXTENSIONS = /\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\?)/i;
7858
7996
  var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\?)/i;
7859
7997
  var canPlay = {
7860
- hls: function(url) {
7998
+ hls: function hls(url) {
7861
7999
  if (!url || typeof url !== "string") return false;
7862
8000
  return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);
7863
8001
  },
7864
- dash: function(url) {
8002
+ dash: function dash(url) {
7865
8003
  if (!url || typeof url !== "string") return false;
7866
8004
  return DASH_EXTENSIONS.test(url);
7867
8005
  },
7868
- video: function(url) {
8006
+ video: function video(url) {
7869
8007
  if (!url || typeof url !== "string") return false;
7870
8008
  return VIDEO_EXTENSIONS.test(url);
7871
8009
  },
7872
- audio: function(url) {
8010
+ audio: function audio(url) {
7873
8011
  if (!url || typeof url !== "string") return false;
7874
8012
  return AUDIO_EXTENSIONS.test(url);
7875
8013
  },
7876
- file: function(url) {
8014
+ file: function file(url) {
7877
8015
  if (!url || typeof url !== "string") return false;
7878
8016
  return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);
7879
8017
  }
@@ -7884,11 +8022,11 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react_Component) {
7884
8022
  function HlsPlayer() {
7885
8023
  _class_call_check(this, HlsPlayer);
7886
8024
  var _this;
7887
- var _this1, _arguments = arguments;
7888
- _this = _call_super(this, HlsPlayer, _to_consumable_array(_arguments)), _this1 = _this;
7889
- _this1.player = null;
7890
- _this1.mounted = false;
7891
- _this1.load = function() {
8025
+ var _this1;
8026
+ _this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
8027
+ _this.player = null;
8028
+ _this.mounted = false;
8029
+ _this.load = function() {
7892
8030
  return _async_to_generator(function() {
7893
8031
  var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
7894
8032
  return _ts_generator(this, function(_state) {
@@ -7961,87 +8099,87 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react_Component) {
7961
8099
  });
7962
8100
  })();
7963
8101
  };
7964
- _this1.play = function() {
7965
- if (_this1.props.videoElement) {
7966
- var video = _this1.props.videoElement;
8102
+ _this.play = function() {
8103
+ if (_this.props.videoElement) {
8104
+ var video = _this.props.videoElement;
7967
8105
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
7968
8106
  if (hasValidSource) {
7969
8107
  var _video_play, _this_props_onPlay, _this_props;
7970
8108
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
7971
8109
  var _this_props_onError, _this_props;
7972
8110
  console.error("[HlsPlayer] Failed to play:", error);
7973
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8111
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
7974
8112
  });
7975
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8113
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
7976
8114
  } else {
7977
8115
  console.warn("[HlsPlayer] Cannot play: video has no valid source");
7978
8116
  }
7979
8117
  }
7980
8118
  };
7981
- _this1.pause = function() {
7982
- if (_this1.props.videoElement) {
8119
+ _this.pause = function() {
8120
+ if (_this.props.videoElement) {
7983
8121
  var _this_props_onPause, _this_props;
7984
- _this1.props.videoElement.pause();
7985
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8122
+ _this.props.videoElement.pause();
8123
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
7986
8124
  }
7987
8125
  };
7988
- _this1.stop = function() {
7989
- _this1.pause();
7990
- if (_this1.props.videoElement) {
7991
- _this1.props.videoElement.currentTime = 0;
8126
+ _this.stop = function() {
8127
+ _this.pause();
8128
+ if (_this.props.videoElement) {
8129
+ _this.props.videoElement.currentTime = 0;
7992
8130
  }
7993
8131
  };
7994
- _this1.seekTo = function(seconds, keepPlaying) {
7995
- if (_this1.props.videoElement) {
7996
- _this1.props.videoElement.currentTime = seconds;
8132
+ _this.seekTo = function(seconds, keepPlaying) {
8133
+ if (_this.props.videoElement) {
8134
+ _this.props.videoElement.currentTime = seconds;
7997
8135
  if (!keepPlaying) {
7998
- _this1.pause();
8136
+ _this.pause();
7999
8137
  }
8000
8138
  }
8001
8139
  };
8002
- _this1.setVolume = function(volume) {
8003
- if (_this1.props.videoElement) {
8004
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8140
+ _this.setVolume = function(volume) {
8141
+ if (_this.props.videoElement) {
8142
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8005
8143
  }
8006
8144
  };
8007
- _this1.mute = function() {
8008
- if (_this1.props.videoElement) {
8009
- _this1.props.videoElement.muted = true;
8145
+ _this.mute = function() {
8146
+ if (_this.props.videoElement) {
8147
+ _this.props.videoElement.muted = true;
8010
8148
  }
8011
8149
  };
8012
- _this1.unmute = function() {
8013
- if (_this1.props.videoElement) {
8014
- _this1.props.videoElement.muted = false;
8150
+ _this.unmute = function() {
8151
+ if (_this.props.videoElement) {
8152
+ _this.props.videoElement.muted = false;
8015
8153
  }
8016
8154
  };
8017
- _this1.setPlaybackRate = function(rate) {
8018
- if (_this1.props.videoElement && rate > 0) {
8019
- _this1.props.videoElement.playbackRate = rate;
8155
+ _this.setPlaybackRate = function(rate) {
8156
+ if (_this.props.videoElement && rate > 0) {
8157
+ _this.props.videoElement.playbackRate = rate;
8020
8158
  }
8021
8159
  };
8022
- _this1.getDuration = function() {
8023
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
8024
- return _this1.props.videoElement.duration;
8160
+ _this.getDuration = function() {
8161
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
8162
+ return _this.props.videoElement.duration;
8025
8163
  }
8026
8164
  return null;
8027
8165
  };
8028
- _this1.getCurrentTime = function() {
8029
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
8030
- return _this1.props.videoElement.currentTime;
8166
+ _this.getCurrentTime = function() {
8167
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
8168
+ return _this.props.videoElement.currentTime;
8031
8169
  }
8032
8170
  return null;
8033
8171
  };
8034
- _this1.getSecondsLoaded = function() {
8035
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
8036
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
8172
+ _this.getSecondsLoaded = function() {
8173
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
8174
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
8037
8175
  }
8038
8176
  return null;
8039
8177
  };
8040
- _this1.getInternalPlayer = function() {
8178
+ _this.getInternalPlayer = function() {
8041
8179
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
8042
- if (key === "player") return _this1.player;
8043
- if (key === "video") return _this1.props.videoElement;
8044
- if (key === "hls" && _this1.player) return _this1.player.hls;
8180
+ if (key === "player") return _this.player;
8181
+ if (key === "video") return _this.props.videoElement;
8182
+ if (key === "hls" && _this.player) return _this.player.hls;
8045
8183
  return null;
8046
8184
  };
8047
8185
  return _this;