stormcloud-video-player 0.5.3 → 0.5.4

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() {
@@ -2478,8 +2486,8 @@ var DEFAULT_TIMEOUT_MS = 3e3;
2478
2486
  var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
2479
2487
  function createPrebidManager() {
2480
2488
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2481
- var initialized = false;
2482
2489
  var _options_debug;
2490
+ var initialized = false;
2483
2491
  var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
2484
2492
  function log() {
2485
2493
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
@@ -2981,6 +2989,8 @@ function createPrebidController(contentVideo, options) {
2981
2989
  adContainerEl.style.display = "none";
2982
2990
  adContainerEl.style.pointerEvents = "none";
2983
2991
  }
2992
+ contentVideo.style.visibility = "visible";
2993
+ contentVideo.style.opacity = "1";
2984
2994
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
2985
2995
  if (contentVideo.paused) {
2986
2996
  console.log("".concat(LOG, " Content video paused in live mode, resuming playback"));
@@ -4289,7 +4299,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4289
4299
  });
4290
4300
  this.hls.on(import_hls3.default.Events.MANIFEST_PARSED, function(_, data) {
4291
4301
  return _async_to_generator(function() {
4292
- var _this_hls_levels, _this_hls, _this_hls_levels_some, adBehavior, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
4302
+ var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
4293
4303
  return _ts_generator(this, function(_state) {
4294
4304
  switch(_state.label){
4295
4305
  case 0:
@@ -4298,10 +4308,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4298
4308
  } else {
4299
4309
  ;
4300
4310
  ;
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) {
4311
+ 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
4312
  var _level_details, _level_details1;
4303
4313
  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;
4314
+ })) !== null && _ref !== void 0 ? _ref : false;
4305
4315
  }
4306
4316
  if (this.config.debugAdTiming) {
4307
4317
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -4365,9 +4375,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4365
4375
  var tag = "";
4366
4376
  var value = "";
4367
4377
  if (Array.isArray(entry)) {
4368
- var _entry_;
4378
+ var _entry_, _entry_1;
4369
4379
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4370
- var _entry_1;
4371
4380
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4372
4381
  } else if (typeof entry === "string") {
4373
4382
  var idx = entry.indexOf(":");
@@ -4490,9 +4499,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4490
4499
  var tag = "";
4491
4500
  var value = "";
4492
4501
  if (Array.isArray(entry)) {
4493
- var _entry_;
4502
+ var _entry_, _entry_1;
4494
4503
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4495
- var _entry_1;
4496
4504
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4497
4505
  } else if (typeof entry === "string") {
4498
4506
  var idx = entry.indexOf(":");
@@ -4542,10 +4550,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4542
4550
  }
4543
4551
  });
4544
4552
  } else if (tag.includes("EXT-X-DATERANGE")) {
4553
+ var _attrs_CLASS;
4545
4554
  var attrs = _this.parseAttributeList(value);
4546
4555
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4547
4556
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4548
- var _attrs_CLASS;
4549
4557
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4550
4558
  var duration = _this.toNumber(attrs["DURATION"]);
4551
4559
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -4947,11 +4955,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4947
4955
  }
4948
4956
  var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
4949
4957
  if (daterangeMatch) {
4950
- var _daterangeMatch_;
4958
+ var _daterangeMatch_, _attrs_CLASS;
4951
4959
  var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
4952
4960
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4953
4961
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4954
- var _attrs_CLASS;
4955
4962
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4956
4963
  var duration = this.toNumber(attrs["DURATION"]);
4957
4964
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -5027,7 +5034,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5027
5034
  var out = "";
5028
5035
  for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
5029
5036
  return out;
5030
- } catch (e) {
5037
+ } catch (unused) {
5031
5038
  return void 0;
5032
5039
  }
5033
5040
  }
@@ -5046,6 +5053,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5046
5053
  });
5047
5054
  }
5048
5055
  if (marker.type === "start") {
5056
+ var _this_config_immediateManifestAds;
5049
5057
  var _this_pendingAdBreak;
5050
5058
  if (!this.video.muted) {
5051
5059
  this.video.muted = true;
@@ -5070,7 +5078,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5070
5078
  this.expectedAdBreakDurationMs = durationMs;
5071
5079
  this.currentAdBreakStartWallClockMs = Date.now();
5072
5080
  var isManifestMarker = this.isManifestBasedMarker(marker);
5073
- var _this_config_immediateManifestAds;
5074
5081
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
5075
5082
  if (this.config.debugAdTiming) {
5076
5083
  console.log("[StormcloudVideoPlayer] Ad start decision:", {
@@ -5225,9 +5232,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5225
5232
  var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
5226
5233
  var match;
5227
5234
  while((match = regex.exec(value)) !== null){
5228
- var _match_;
5235
+ var _match_, _ref, _match_1;
5229
5236
  var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
5230
- var _match_1, _ref;
5231
5237
  var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
5232
5238
  if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
5233
5239
  rawVal = rawVal.slice(1, -1);
@@ -5586,13 +5592,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5586
5592
  {
5587
5593
  key: "shouldShowNativeControls",
5588
5594
  value: function shouldShowNativeControls() {
5595
+ var _this_config_showCustomControls;
5589
5596
  var streamType = this.getStreamType();
5590
5597
  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);
5598
+ var _this_config_showCustomControls1;
5599
+ return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
5593
5600
  }
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));
5601
+ return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
5596
5602
  }
5597
5603
  },
5598
5604
  {
@@ -5751,12 +5757,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5751
5757
  continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
5752
5758
  preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
5753
5759
  preloadIma.initialize();
5754
- errorListener = function(payload) {
5760
+ errorListener = function errorListener(payload) {
5755
5761
  hasAdError = true;
5756
5762
  adErrorPayload = payload;
5757
5763
  };
5758
5764
  preloadIma.on("ad_error", errorListener);
5759
- errorListenerCleanup = function() {
5765
+ errorListenerCleanup = function errorListenerCleanup() {
5760
5766
  return preloadIma.off("ad_error", errorListener);
5761
5767
  };
5762
5768
  return [
@@ -5807,7 +5813,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5807
5813
  isReady: true,
5808
5814
  loadPromise: Promise.resolve()
5809
5815
  };
5810
- lateErrorListener = function(payload) {
5816
+ lateErrorListener = function lateErrorListener(payload) {
5811
5817
  var index = _this.preloadPool.findIndex(function(entry) {
5812
5818
  return entry.vastUrl === vastUrl;
5813
5819
  });
@@ -5818,7 +5824,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5818
5824
  }
5819
5825
  try {
5820
5826
  preloadIma.destroy();
5821
- } catch (e) {}
5827
+ } catch (unused) {}
5822
5828
  }
5823
5829
  };
5824
5830
  preloadIma.on("ad_error", lateErrorListener);
@@ -6643,7 +6649,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6643
6649
  10
6644
6650
  ];
6645
6651
  nextAdUrl = this.adRequestQueue.shift();
6646
- if (!nextAdUrl) {
6652
+ if (nextAdUrl == null) {
6647
6653
  return [
6648
6654
  3,
6649
6655
  4
@@ -6829,7 +6835,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6829
6835
  9
6830
6836
  ];
6831
6837
  nextAdUrl = this.adRequestQueue.shift();
6832
- if (!nextAdUrl) {
6838
+ if (nextAdUrl == null) {
6833
6839
  return [
6834
6840
  3,
6835
6841
  3
@@ -7034,11 +7040,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7034
7040
  {
7035
7041
  key: "ensureAdStoppedByTimer",
7036
7042
  value: function ensureAdStoppedByTimer() {
7043
+ var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
7037
7044
  if (!this.inAdBreak) return;
7038
7045
  this.adStopTimerId = void 0;
7039
7046
  var adPlaying = this.ima.isAdPlaying();
7040
7047
  var pendingAds = this.adPodQueue.length > 0;
7041
- var _this_config_adBreakCheckIntervalMs;
7042
7048
  var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
7043
7049
  var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
7044
7050
  var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
@@ -7046,7 +7052,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7046
7052
  if (this.currentAdBreakStartWallClockMs != null) {
7047
7053
  elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
7048
7054
  }
7049
- var _this_expectedAdBreakDurationMs;
7050
7055
  var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
7051
7056
  var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
7052
7057
  var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
@@ -7303,15 +7308,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7303
7308
  9
7304
7309
  ];
7305
7310
  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");
7311
+ if (vastTagUrl) {
7312
+ if (this.isTemporaryAdError(playError)) {
7313
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7314
+ if (this.config.debugAdTiming) {
7315
+ console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
7316
+ }
7317
+ } else {
7318
+ this.failedVastUrls.add(vastTagUrl);
7319
+ if (this.config.debugAdTiming) {
7320
+ console.log("[AD-ERROR] Permanent play error - URL blacklisted");
7321
+ }
7315
7322
  }
7316
7323
  }
7317
7324
  this.clearAdFailsafeTimer();
@@ -7380,15 +7387,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7380
7387
  15
7381
7388
  ];
7382
7389
  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);
7390
+ if (vastTagUrl) {
7391
+ if (this.isTemporaryAdError(error)) {
7392
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7393
+ if (this.config.debugAdTiming) {
7394
+ console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
7395
+ }
7396
+ } else {
7397
+ this.failedVastUrls.add(vastTagUrl);
7398
+ if (this.config.debugAdTiming) {
7399
+ console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
7400
+ }
7392
7401
  }
7393
7402
  }
7394
7403
  this.clearAdRequestWatchdog();
@@ -7491,8 +7500,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7491
7500
  key: "startAdRequestWatchdog",
7492
7501
  value: function startAdRequestWatchdog(token) {
7493
7502
  var _this = this;
7494
- this.clearAdRequestWatchdog();
7495
7503
  var _this_config_adFailsafeTimeoutMs;
7504
+ this.clearAdRequestWatchdog();
7496
7505
  var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7497
7506
  this.adRequestWatchdogToken = token;
7498
7507
  this.adRequestWatchdogId = window.setTimeout(function() {
@@ -7535,8 +7544,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7535
7544
  key: "startAdFailsafeTimer",
7536
7545
  value: function startAdFailsafeTimer(token) {
7537
7546
  var _this = this;
7538
- this.clearAdFailsafeTimer();
7539
7547
  var _this_config_adFailsafeTimeoutMs;
7548
+ this.clearAdFailsafeTimer();
7540
7549
  var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7541
7550
  this.adFailsafeToken = token;
7542
7551
  this.adFailsafeTimerId = window.setTimeout(function() {
@@ -7857,23 +7866,23 @@ var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
7857
7866
  var VIDEO_EXTENSIONS = /\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\?)/i;
7858
7867
  var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\?)/i;
7859
7868
  var canPlay = {
7860
- hls: function(url) {
7869
+ hls: function hls(url) {
7861
7870
  if (!url || typeof url !== "string") return false;
7862
7871
  return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);
7863
7872
  },
7864
- dash: function(url) {
7873
+ dash: function dash(url) {
7865
7874
  if (!url || typeof url !== "string") return false;
7866
7875
  return DASH_EXTENSIONS.test(url);
7867
7876
  },
7868
- video: function(url) {
7877
+ video: function video(url) {
7869
7878
  if (!url || typeof url !== "string") return false;
7870
7879
  return VIDEO_EXTENSIONS.test(url);
7871
7880
  },
7872
- audio: function(url) {
7881
+ audio: function audio(url) {
7873
7882
  if (!url || typeof url !== "string") return false;
7874
7883
  return AUDIO_EXTENSIONS.test(url);
7875
7884
  },
7876
- file: function(url) {
7885
+ file: function file(url) {
7877
7886
  if (!url || typeof url !== "string") return false;
7878
7887
  return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);
7879
7888
  }
@@ -7884,11 +7893,11 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react_Component) {
7884
7893
  function HlsPlayer() {
7885
7894
  _class_call_check(this, HlsPlayer);
7886
7895
  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() {
7896
+ var _this1;
7897
+ _this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
7898
+ _this.player = null;
7899
+ _this.mounted = false;
7900
+ _this.load = function() {
7892
7901
  return _async_to_generator(function() {
7893
7902
  var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
7894
7903
  return _ts_generator(this, function(_state) {
@@ -7961,87 +7970,87 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react_Component) {
7961
7970
  });
7962
7971
  })();
7963
7972
  };
7964
- _this1.play = function() {
7965
- if (_this1.props.videoElement) {
7966
- var video = _this1.props.videoElement;
7973
+ _this.play = function() {
7974
+ if (_this.props.videoElement) {
7975
+ var video = _this.props.videoElement;
7967
7976
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
7968
7977
  if (hasValidSource) {
7969
7978
  var _video_play, _this_props_onPlay, _this_props;
7970
7979
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
7971
7980
  var _this_props_onError, _this_props;
7972
7981
  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);
7982
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
7974
7983
  });
7975
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
7984
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
7976
7985
  } else {
7977
7986
  console.warn("[HlsPlayer] Cannot play: video has no valid source");
7978
7987
  }
7979
7988
  }
7980
7989
  };
7981
- _this1.pause = function() {
7982
- if (_this1.props.videoElement) {
7990
+ _this.pause = function() {
7991
+ if (_this.props.videoElement) {
7983
7992
  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);
7993
+ _this.props.videoElement.pause();
7994
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
7986
7995
  }
7987
7996
  };
7988
- _this1.stop = function() {
7989
- _this1.pause();
7990
- if (_this1.props.videoElement) {
7991
- _this1.props.videoElement.currentTime = 0;
7997
+ _this.stop = function() {
7998
+ _this.pause();
7999
+ if (_this.props.videoElement) {
8000
+ _this.props.videoElement.currentTime = 0;
7992
8001
  }
7993
8002
  };
7994
- _this1.seekTo = function(seconds, keepPlaying) {
7995
- if (_this1.props.videoElement) {
7996
- _this1.props.videoElement.currentTime = seconds;
8003
+ _this.seekTo = function(seconds, keepPlaying) {
8004
+ if (_this.props.videoElement) {
8005
+ _this.props.videoElement.currentTime = seconds;
7997
8006
  if (!keepPlaying) {
7998
- _this1.pause();
8007
+ _this.pause();
7999
8008
  }
8000
8009
  }
8001
8010
  };
8002
- _this1.setVolume = function(volume) {
8003
- if (_this1.props.videoElement) {
8004
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8011
+ _this.setVolume = function(volume) {
8012
+ if (_this.props.videoElement) {
8013
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8005
8014
  }
8006
8015
  };
8007
- _this1.mute = function() {
8008
- if (_this1.props.videoElement) {
8009
- _this1.props.videoElement.muted = true;
8016
+ _this.mute = function() {
8017
+ if (_this.props.videoElement) {
8018
+ _this.props.videoElement.muted = true;
8010
8019
  }
8011
8020
  };
8012
- _this1.unmute = function() {
8013
- if (_this1.props.videoElement) {
8014
- _this1.props.videoElement.muted = false;
8021
+ _this.unmute = function() {
8022
+ if (_this.props.videoElement) {
8023
+ _this.props.videoElement.muted = false;
8015
8024
  }
8016
8025
  };
8017
- _this1.setPlaybackRate = function(rate) {
8018
- if (_this1.props.videoElement && rate > 0) {
8019
- _this1.props.videoElement.playbackRate = rate;
8026
+ _this.setPlaybackRate = function(rate) {
8027
+ if (_this.props.videoElement && rate > 0) {
8028
+ _this.props.videoElement.playbackRate = rate;
8020
8029
  }
8021
8030
  };
8022
- _this1.getDuration = function() {
8023
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
8024
- return _this1.props.videoElement.duration;
8031
+ _this.getDuration = function() {
8032
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
8033
+ return _this.props.videoElement.duration;
8025
8034
  }
8026
8035
  return null;
8027
8036
  };
8028
- _this1.getCurrentTime = function() {
8029
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
8030
- return _this1.props.videoElement.currentTime;
8037
+ _this.getCurrentTime = function() {
8038
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
8039
+ return _this.props.videoElement.currentTime;
8031
8040
  }
8032
8041
  return null;
8033
8042
  };
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);
8043
+ _this.getSecondsLoaded = function() {
8044
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
8045
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
8037
8046
  }
8038
8047
  return null;
8039
8048
  };
8040
- _this1.getInternalPlayer = function() {
8049
+ _this.getInternalPlayer = function() {
8041
8050
  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;
8051
+ if (key === "player") return _this.player;
8052
+ if (key === "video") return _this.props.videoElement;
8053
+ if (key === "hls" && _this.player) return _this.player.hls;
8045
8054
  return null;
8046
8055
  };
8047
8056
  return _this;