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.
package/lib/index.js CHANGED
@@ -180,12 +180,22 @@ function _object_spread_props(target, source) {
180
180
  }
181
181
  function _object_without_properties(source, excluded) {
182
182
  if (source == null) return {};
183
- var target = _object_without_properties_loose(source, excluded);
184
- var key, i;
183
+ var target = {}, sourceKeys, key, i;
184
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
185
+ sourceKeys = Reflect.ownKeys(Object(source));
186
+ for(i = 0; i < sourceKeys.length; i++){
187
+ key = sourceKeys[i];
188
+ if (excluded.indexOf(key) >= 0) continue;
189
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
190
+ target[key] = source[key];
191
+ }
192
+ return target;
193
+ }
194
+ target = _object_without_properties_loose(source, excluded);
185
195
  if (Object.getOwnPropertySymbols) {
186
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
187
- for(i = 0; i < sourceSymbolKeys.length; i++){
188
- key = sourceSymbolKeys[i];
196
+ sourceKeys = Object.getOwnPropertySymbols(source);
197
+ for(i = 0; i < sourceKeys.length; i++){
198
+ key = sourceKeys[i];
189
199
  if (excluded.indexOf(key) >= 0) continue;
190
200
  if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
191
201
  target[key] = source[key];
@@ -195,12 +205,11 @@ function _object_without_properties(source, excluded) {
195
205
  }
196
206
  function _object_without_properties_loose(source, excluded) {
197
207
  if (source == null) return {};
198
- var target = {};
199
- var sourceKeys = Object.keys(source);
200
- var key, i;
208
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
201
209
  for(i = 0; i < sourceKeys.length; i++){
202
210
  key = sourceKeys[i];
203
211
  if (excluded.indexOf(key) >= 0) continue;
212
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
204
213
  target[key] = source[key];
205
214
  }
206
215
  return target;
@@ -253,9 +262,17 @@ function _ts_generator(thisArg, body) {
253
262
  },
254
263
  trys: [],
255
264
  ops: []
256
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
257
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
258
- return this;
265
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
266
+ return d(g, "next", {
267
+ value: verb(0)
268
+ }), d(g, "throw", {
269
+ value: verb(1)
270
+ }), d(g, "return", {
271
+ value: verb(2)
272
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
273
+ value: function() {
274
+ return this;
275
+ }
259
276
  }), g;
260
277
  function verb(n) {
261
278
  return function(v) {
@@ -709,7 +726,7 @@ function createImaController(video, options) {
709
726
  var fn = _step.value;
710
727
  try {
711
728
  fn(payload);
712
- } catch (e) {}
729
+ } catch (unused) {}
713
730
  }
714
731
  } catch (err) {
715
732
  _didIteratorError = true;
@@ -747,7 +764,7 @@ function createImaController(video, options) {
747
764
  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'.");
748
765
  }
749
766
  }
750
- } catch (e) {}
767
+ } catch (unused) {}
751
768
  if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
752
769
  var existing = document.querySelector('script[data-ima="true"]');
753
770
  if (existing) {
@@ -995,7 +1012,7 @@ function createImaController(video, options) {
995
1012
  if (adsManager) {
996
1013
  try {
997
1014
  adsManager.destroy();
998
- } catch (e) {}
1015
+ } catch (unused) {}
999
1016
  adsManager = void 0;
1000
1017
  }
1001
1018
  if (adVideoElement) {
@@ -1006,7 +1023,7 @@ function createImaController(video, options) {
1006
1023
  if (adsLoader) {
1007
1024
  try {
1008
1025
  adsLoader.destroy();
1009
- } catch (e) {}
1026
+ } catch (unused) {}
1010
1027
  adsLoader = void 0;
1011
1028
  }
1012
1029
  }
@@ -1024,7 +1041,7 @@ function createImaController(video, options) {
1024
1041
  try {
1025
1042
  var _adDisplayContainer_initialize;
1026
1043
  (_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
1027
- } catch (e) {}
1044
+ } catch (unused) {}
1028
1045
  }
1029
1046
  }).catch(function() {});
1030
1047
  },
@@ -1183,7 +1200,7 @@ function createImaController(video, options) {
1183
1200
  window.setTimeout(function() {
1184
1201
  try {
1185
1202
  makeAdsRequest(google, lastAdTagUrl);
1186
- } catch (e) {}
1203
+ } catch (unused) {}
1187
1204
  }, delay);
1188
1205
  } else {
1189
1206
  emit("ad_error", {
@@ -1215,7 +1232,7 @@ function createImaController(video, options) {
1215
1232
  if (adsManager) {
1216
1233
  try {
1217
1234
  adsManager.setVolume(adVolume);
1218
- } catch (e) {}
1235
+ } catch (unused) {}
1219
1236
  }
1220
1237
  emit("content_pause");
1221
1238
  });
@@ -1229,7 +1246,7 @@ function createImaController(video, options) {
1229
1246
  if (adsManager) {
1230
1247
  try {
1231
1248
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1232
- } catch (e) {}
1249
+ } catch (unused) {}
1233
1250
  }
1234
1251
  }
1235
1252
  if (adContainerEl) {
@@ -1390,7 +1407,7 @@ function createImaController(video, options) {
1390
1407
  }
1391
1408
  try {
1392
1409
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1393
- } catch (e) {}
1410
+ } catch (unused) {}
1394
1411
  adsManager.start();
1395
1412
  return [
1396
1413
  2,
@@ -1472,7 +1489,7 @@ function createImaController(video, options) {
1472
1489
  try {
1473
1490
  ;
1474
1491
  adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
1475
- } catch (e) {}
1492
+ } catch (unused) {}
1476
1493
  destroyAdsManager();
1477
1494
  return [
1478
1495
  2
@@ -1503,7 +1520,7 @@ function createImaController(video, options) {
1503
1520
  try {
1504
1521
  var _adsLoader_destroy;
1505
1522
  adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
1506
- } catch (e) {}
1523
+ } catch (unused) {}
1507
1524
  adDisplayContainer = void 0;
1508
1525
  adsLoader = void 0;
1509
1526
  contentVideoHidden = false;
@@ -1552,7 +1569,7 @@ function createImaController(video, options) {
1552
1569
  if (adsManager && adPlaying) {
1553
1570
  try {
1554
1571
  adsManager.setVolume(clampedVolume);
1555
- } catch (e) {}
1572
+ } catch (unused) {}
1556
1573
  }
1557
1574
  },
1558
1575
  getAdVolume: function getAdVolume() {
@@ -2040,10 +2057,10 @@ function createHlsAdPlayer(contentVideo, options) {
2040
2057
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
2041
2058
  if (contentVideo.paused) {
2042
2059
  console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback");
2043
- contentVideo.play().catch(function() {});
2044
2060
  } else {
2045
2061
  console.log("[HlsAdPlayer] Content video already playing in live mode");
2046
2062
  }
2063
+ contentVideo.play().catch(function() {});
2047
2064
  }
2048
2065
  emit("content_resume");
2049
2066
  }
@@ -2316,8 +2333,8 @@ function createHlsAdPlayer(contentVideo, options) {
2316
2333
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
2317
2334
  if (contentVideo.paused) {
2318
2335
  console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback on stop");
2319
- contentVideo.play().catch(function() {});
2320
2336
  }
2337
+ contentVideo.play().catch(function() {});
2321
2338
  }
2322
2339
  if (adHls) {
2323
2340
  adHls.destroy();
@@ -2326,6 +2343,8 @@ function createHlsAdPlayer(contentVideo, options) {
2326
2343
  if (adVideoElement) {
2327
2344
  adVideoElement.pause();
2328
2345
  adVideoElement.src = "";
2346
+ adVideoElement.remove();
2347
+ adVideoElement = void 0;
2329
2348
  }
2330
2349
  currentAd = void 0;
2331
2350
  return [
@@ -2468,8 +2487,8 @@ var DEFAULT_TIMEOUT_MS = 3e3;
2468
2487
  var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
2469
2488
  function createPrebidManager() {
2470
2489
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2471
- var initialized = false;
2472
2490
  var _options_debug;
2491
+ var initialized = false;
2473
2492
  var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
2474
2493
  function log() {
2475
2494
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
@@ -2971,13 +2990,15 @@ function createPrebidController(contentVideo, options) {
2971
2990
  adContainerEl.style.display = "none";
2972
2991
  adContainerEl.style.pointerEvents = "none";
2973
2992
  }
2993
+ contentVideo.style.visibility = "visible";
2994
+ contentVideo.style.opacity = "1";
2974
2995
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
2975
2996
  if (contentVideo.paused) {
2976
2997
  console.log("".concat(LOG, " Content video paused in live mode, resuming playback"));
2977
- contentVideo.play().catch(function() {});
2978
2998
  } else {
2979
2999
  console.log("".concat(LOG, " Content video already playing in live mode"));
2980
3000
  }
3001
+ contentVideo.play().catch(function() {});
2981
3002
  }
2982
3003
  emit("content_resume");
2983
3004
  }
@@ -3343,8 +3364,8 @@ function createPrebidController(contentVideo, options) {
3343
3364
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
3344
3365
  if (contentVideo.paused) {
3345
3366
  console.log("".concat(LOG, " Content video paused in live mode, resuming playback on stop"));
3346
- contentVideo.play().catch(function() {});
3347
3367
  }
3368
+ contentVideo.play().catch(function() {});
3348
3369
  }
3349
3370
  if (adHls) {
3350
3371
  adHls.destroy();
@@ -3353,6 +3374,8 @@ function createPrebidController(contentVideo, options) {
3353
3374
  if (adVideoElement) {
3354
3375
  adVideoElement.pause();
3355
3376
  adVideoElement.src = "";
3377
+ adVideoElement.remove();
3378
+ adVideoElement = void 0;
3356
3379
  }
3357
3380
  currentAd = void 0;
3358
3381
  return [
@@ -4124,6 +4147,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4124
4147
  this.minAdRequestIntervalMs = 2500;
4125
4148
  this.backoffBaseMs = 1e3;
4126
4149
  this.maxBackoffMs = 15e3;
4150
+ this.continuousFetchWallClockBufferMs = 3e4;
4151
+ this.continuousFetchMaxIterations = 500;
4152
+ this.continuousFetchQueueFullConsecutiveWaits = 0;
4127
4153
  this.preloadPool = [];
4128
4154
  this.maxPreloadPoolSize = 3;
4129
4155
  this.preloadPoolActive = false;
@@ -4183,6 +4209,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4183
4209
  }
4184
4210
  }
4185
4211
  },
4212
+ {
4213
+ key: "getAdPlayerTypeLabel",
4214
+ value: function getAdPlayerTypeLabel() {
4215
+ var t = this.config.adPlayerType;
4216
+ if (t === "prebid") return "Prebid";
4217
+ if (t === "hls") return "HLS";
4218
+ return "IMA";
4219
+ }
4220
+ },
4186
4221
  {
4187
4222
  key: "load",
4188
4223
  value: function load() {
@@ -4282,7 +4317,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4282
4317
  });
4283
4318
  this.hls.on(Hls3.Events.MANIFEST_PARSED, function(_, data) {
4284
4319
  return _async_to_generator(function() {
4285
- var _this_hls_levels, _this_hls, _this_hls_levels_some, adBehavior, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
4320
+ var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
4286
4321
  return _ts_generator(this, function(_state) {
4287
4322
  switch(_state.label){
4288
4323
  case 0:
@@ -4291,10 +4326,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4291
4326
  } else {
4292
4327
  ;
4293
4328
  ;
4294
- 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) {
4329
+ 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) {
4295
4330
  var _level_details, _level_details1;
4296
4331
  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";
4297
- })) !== null && _this_hls_levels_some !== void 0 ? _this_hls_levels_some : false;
4332
+ })) !== null && _ref !== void 0 ? _ref : false;
4298
4333
  }
4299
4334
  if (this.config.debugAdTiming) {
4300
4335
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -4358,9 +4393,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4358
4393
  var tag = "";
4359
4394
  var value = "";
4360
4395
  if (Array.isArray(entry)) {
4361
- var _entry_;
4396
+ var _entry_, _entry_1;
4362
4397
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4363
- var _entry_1;
4364
4398
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4365
4399
  } else if (typeof entry === "string") {
4366
4400
  var idx = entry.indexOf(":");
@@ -4483,9 +4517,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4483
4517
  var tag = "";
4484
4518
  var value = "";
4485
4519
  if (Array.isArray(entry)) {
4486
- var _entry_;
4520
+ var _entry_, _entry_1;
4487
4521
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4488
- var _entry_1;
4489
4522
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4490
4523
  } else if (typeof entry === "string") {
4491
4524
  var idx = entry.indexOf(":");
@@ -4535,10 +4568,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4535
4568
  }
4536
4569
  });
4537
4570
  } else if (tag.includes("EXT-X-DATERANGE")) {
4571
+ var _attrs_CLASS;
4538
4572
  var attrs = _this.parseAttributeList(value);
4539
4573
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4540
4574
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4541
- var _attrs_CLASS;
4542
4575
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4543
4576
  var duration = _this.toNumber(attrs["DURATION"]);
4544
4577
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -4674,6 +4707,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4674
4707
  }
4675
4708
  });
4676
4709
  this.ima.on("content_resume", function() {
4710
+ console.log("[StormcloudVideoPlayer] content_resume received, inAdBreak=%s, remaining=%s", _this.inAdBreak, _this.getRemainingAdMs());
4677
4711
  if (!_this.video.muted) {
4678
4712
  _this.video.muted = true;
4679
4713
  _this.video.volume = 0;
@@ -4704,15 +4738,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4704
4738
  }
4705
4739
  },
4706
4740
  {
4707
- key: "recreateImaController",
4708
- value: function recreateImaController() {
4741
+ key: "recreateAdController",
4742
+ value: function recreateAdController() {
4743
+ var label = this.getAdPlayerTypeLabel();
4709
4744
  if (this.config.debugAdTiming) {
4710
- console.log("[StormcloudVideoPlayer] Recreating ImaController for new ad");
4745
+ console.log("[StormcloudVideoPlayer] Recreating ad controller (".concat(label, ") for new ad"));
4711
4746
  }
4712
4747
  var shouldShowPlaceholder = this.inAdBreak && this.showAds;
4713
4748
  if (shouldShowPlaceholder && this.ima) {
4714
4749
  if (this.config.debugAdTiming) {
4715
- console.log("[StormcloudVideoPlayer] Showing placeholder before destroying old ImaController");
4750
+ console.log("[StormcloudVideoPlayer] Showing placeholder before destroying old ".concat(label, " controller"));
4716
4751
  }
4717
4752
  this.showPlaceholderLayer();
4718
4753
  this.ima.showPlaceholder();
@@ -4725,7 +4760,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4725
4760
  this.video.volume = 0;
4726
4761
  } catch (error) {
4727
4762
  if (this.config.debugAdTiming) {
4728
- console.warn("[StormcloudVideoPlayer] Error destroying old ImaController:", error);
4763
+ console.warn("[StormcloudVideoPlayer] Error destroying old ".concat(label, " controller:"), error);
4729
4764
  }
4730
4765
  }
4731
4766
  }
@@ -4805,7 +4840,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4805
4840
  });
4806
4841
  }
4807
4842
  if (this.config.debugAdTiming) {
4808
- console.log("[StormcloudVideoPlayer] Showing placeholder layer (between content and IMA)");
4843
+ console.log("[StormcloudVideoPlayer] Showing placeholder layer (between content and ".concat(this.getAdPlayerTypeLabel(), ")"));
4809
4844
  }
4810
4845
  }
4811
4846
  },
@@ -4940,11 +4975,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4940
4975
  }
4941
4976
  var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
4942
4977
  if (daterangeMatch) {
4943
- var _daterangeMatch_;
4978
+ var _daterangeMatch_, _attrs_CLASS;
4944
4979
  var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
4945
4980
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4946
4981
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4947
- var _attrs_CLASS;
4948
4982
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4949
4983
  var duration = this.toNumber(attrs["DURATION"]);
4950
4984
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -5020,7 +5054,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5020
5054
  var out = "";
5021
5055
  for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
5022
5056
  return out;
5023
- } catch (e) {
5057
+ } catch (unused) {
5024
5058
  return void 0;
5025
5059
  }
5026
5060
  }
@@ -5039,6 +5073,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5039
5073
  });
5040
5074
  }
5041
5075
  if (marker.type === "start") {
5076
+ var _this_config_immediateManifestAds;
5042
5077
  var _this_pendingAdBreak;
5043
5078
  if (!this.video.muted) {
5044
5079
  this.video.muted = true;
@@ -5063,7 +5098,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5063
5098
  this.expectedAdBreakDurationMs = durationMs;
5064
5099
  this.currentAdBreakStartWallClockMs = Date.now();
5065
5100
  var isManifestMarker = this.isManifestBasedMarker(marker);
5066
- var _this_config_immediateManifestAds;
5067
5101
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
5068
5102
  if (this.config.debugAdTiming) {
5069
5103
  console.log("[StormcloudVideoPlayer] Ad start decision:", {
@@ -5218,9 +5252,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5218
5252
  var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
5219
5253
  var match;
5220
5254
  while((match = regex.exec(value)) !== null){
5221
- var _match_;
5255
+ var _match_, _ref, _match_1;
5222
5256
  var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
5223
- var _match_1, _ref;
5224
5257
  var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
5225
5258
  if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
5226
5259
  rawVal = rawVal.slice(1, -1);
@@ -5519,6 +5552,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5519
5552
  return this.config.adPlayerType === "prebid";
5520
5553
  }
5521
5554
  },
5555
+ {
5556
+ key: "isLgStbDevice",
5557
+ value: function isLgStbDevice() {
5558
+ if (typeof navigator === "undefined" || !navigator.userAgent) return false;
5559
+ var ua = navigator.userAgent;
5560
+ return /Web0S|webOS|LG Browser|LGSTB/i.test(ua);
5561
+ }
5562
+ },
5522
5563
  {
5523
5564
  key: "getCurrentAdIndex",
5524
5565
  value: function getCurrentAdIndex() {
@@ -5579,13 +5620,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5579
5620
  {
5580
5621
  key: "shouldShowNativeControls",
5581
5622
  value: function shouldShowNativeControls() {
5623
+ var _this_config_showCustomControls;
5582
5624
  var streamType = this.getStreamType();
5583
5625
  if (streamType === "other") {
5584
- var _this_config_showCustomControls;
5585
- return !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false);
5626
+ var _this_config_showCustomControls1;
5627
+ return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
5586
5628
  }
5587
- var _this_config_showCustomControls1;
5588
- return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
5629
+ return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
5589
5630
  }
5590
5631
  },
5591
5632
  {
@@ -5744,12 +5785,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5744
5785
  continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
5745
5786
  preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
5746
5787
  preloadIma.initialize();
5747
- errorListener = function(payload) {
5788
+ errorListener = function errorListener(payload) {
5748
5789
  hasAdError = true;
5749
5790
  adErrorPayload = payload;
5750
5791
  };
5751
5792
  preloadIma.on("ad_error", errorListener);
5752
- errorListenerCleanup = function() {
5793
+ errorListenerCleanup = function errorListenerCleanup() {
5753
5794
  return preloadIma.off("ad_error", errorListener);
5754
5795
  };
5755
5796
  return [
@@ -5800,7 +5841,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5800
5841
  isReady: true,
5801
5842
  loadPromise: Promise.resolve()
5802
5843
  };
5803
- lateErrorListener = function(payload) {
5844
+ lateErrorListener = function lateErrorListener(payload) {
5804
5845
  var index = _this.preloadPool.findIndex(function(entry) {
5805
5846
  return entry.vastUrl === vastUrl;
5806
5847
  });
@@ -5811,7 +5852,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5811
5852
  }
5812
5853
  try {
5813
5854
  preloadIma.destroy();
5814
- } catch (e) {}
5855
+ } catch (unused) {}
5815
5856
  }
5816
5857
  };
5817
5858
  preloadIma.on("ad_error", lateErrorListener);
@@ -6333,15 +6374,34 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6333
6374
  key: "continuousFetchLoop",
6334
6375
  value: function continuousFetchLoop(baseVastUrl) {
6335
6376
  return _async_to_generator(function() {
6336
- var _this, _loop, _ret;
6377
+ var loopIterations, _this, _loop, _ret;
6337
6378
  return _ts_generator(this, function(_state) {
6338
6379
  switch(_state.label){
6339
6380
  case 0:
6381
+ loopIterations = 0;
6382
+ _state.label = 1;
6383
+ case 1:
6384
+ _state.trys.push([
6385
+ 1,
6386
+ ,
6387
+ 5,
6388
+ 6
6389
+ ]);
6340
6390
  _loop = function() {
6341
- var remaining, maxQueueSize, newAdUrl, queuedUrlsPreview, generationDelay;
6391
+ var remaining, elapsedMs, maxLoopMs, maxQueueSize, newAdUrl, queuedUrlsPreview, generationDelay;
6342
6392
  return _ts_generator(this, function(_state) {
6343
6393
  switch(_state.label){
6344
6394
  case 0:
6395
+ loopIterations++;
6396
+ if (loopIterations > _this.continuousFetchMaxIterations) {
6397
+ if (_this.config.debugAdTiming) {
6398
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Max iterations reached (".concat(_this.continuousFetchMaxIterations, "), stopping URL generation"));
6399
+ }
6400
+ return [
6401
+ 2,
6402
+ "break"
6403
+ ];
6404
+ }
6345
6405
  remaining = _this.getRemainingAdMs();
6346
6406
  if (remaining <= 0) {
6347
6407
  if (_this.config.debugAdTiming) {
@@ -6352,6 +6412,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6352
6412
  "break"
6353
6413
  ];
6354
6414
  }
6415
+ if (_this.currentAdBreakStartWallClockMs != null && _this.expectedAdBreakDurationMs != null) {
6416
+ elapsedMs = Date.now() - _this.currentAdBreakStartWallClockMs;
6417
+ maxLoopMs = _this.expectedAdBreakDurationMs + _this.continuousFetchWallClockBufferMs;
6418
+ if (elapsedMs >= maxLoopMs) {
6419
+ if (_this.config.debugAdTiming) {
6420
+ console.log("[CONTINUOUS-FETCH] ⏹️ Wall-clock limit reached (".concat(elapsedMs, "ms >= ").concat(maxLoopMs, "ms), stopping URL generation"));
6421
+ }
6422
+ return [
6423
+ 2,
6424
+ "break"
6425
+ ];
6426
+ }
6427
+ }
6355
6428
  if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
6356
6429
  if (_this.config.debugAdTiming) {
6357
6430
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
@@ -6373,46 +6446,63 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6373
6446
  maxQueueSize = 5;
6374
6447
  if (!(_this.adRequestQueue.length >= maxQueueSize)) return [
6375
6448
  3,
6376
- 2
6449
+ 4
6377
6450
  ];
6451
+ if (!(_this.isPrebidMode() && _this.isLgStbDevice())) return [
6452
+ 3,
6453
+ 1
6454
+ ];
6455
+ _this.adRequestQueue.shift();
6456
+ _this.adRequestQueue.push("");
6457
+ _this.totalAdsInBreak++;
6458
+ _this.continuousFetchQueueFullConsecutiveWaits = 0;
6378
6459
  if (_this.config.debugAdTiming) {
6379
- console.log("[CONTINUOUS-FETCH] ⏸️ URL queue full (".concat(_this.adRequestQueue.length, "), waiting..."));
6460
+ console.log("[CONTINUOUS-FETCH] Prebid slot rotated (queue full, dropped oldest); queue: ".concat(_this.adRequestQueue.length));
6380
6461
  }
6381
6462
  return [
6382
- 4,
6383
- new Promise(function(resolve) {
6384
- return setTimeout(resolve, 1e3);
6385
- })
6463
+ 3,
6464
+ 3
6386
6465
  ];
6387
6466
  case 1:
6467
+ return [
6468
+ 4,
6469
+ _this.waitForQueueWithBackoff()
6470
+ ];
6471
+ case 2:
6388
6472
  _state.sent();
6389
6473
  return [
6390
6474
  2,
6391
6475
  "continue"
6392
6476
  ];
6393
- case 2:
6477
+ case 3:
6478
+ return [
6479
+ 3,
6480
+ 8
6481
+ ];
6482
+ case 4:
6394
6483
  if (!_this.isPrebidMode()) return [
6395
6484
  3,
6396
- 3
6485
+ 5
6397
6486
  ];
6398
6487
  _this.adRequestQueue.push("");
6399
6488
  _this.totalAdsInBreak++;
6489
+ _this.continuousFetchQueueFullConsecutiveWaits = 0;
6400
6490
  if (_this.config.debugAdTiming) {
6401
6491
  console.log("[CONTINUOUS-FETCH] Prebid auction slot queued (queue: ".concat(_this.adRequestQueue.length, ")"));
6402
6492
  }
6403
6493
  return [
6404
6494
  3,
6405
- 6
6495
+ 8
6406
6496
  ];
6407
- case 3:
6497
+ case 5:
6408
6498
  if (!baseVastUrl) return [
6409
6499
  3,
6410
- 6
6500
+ 8
6411
6501
  ];
6412
6502
  newAdUrl = _this.generateVastUrlsWithCorrelators(baseVastUrl, 1)[0];
6413
6503
  if (!(!newAdUrl || _this.failedVastUrls.has(newAdUrl) || _this.isUrlInCooldown(newAdUrl))) return [
6414
6504
  3,
6415
- 5
6505
+ 7
6416
6506
  ];
6417
6507
  return [
6418
6508
  4,
@@ -6420,13 +6510,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6420
6510
  return setTimeout(resolve, 500);
6421
6511
  })
6422
6512
  ];
6423
- case 4:
6513
+ case 6:
6424
6514
  _state.sent();
6425
6515
  return [
6426
6516
  2,
6427
6517
  "continue"
6428
6518
  ];
6429
- case 5:
6519
+ case 7:
6430
6520
  if (_this.config.debugAdTiming) {
6431
6521
  queuedUrlsPreview = _to_consumable_array(_this.adRequestQueue).concat([
6432
6522
  newAdUrl
@@ -6437,8 +6527,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6437
6527
  }
6438
6528
  _this.adRequestQueue.push(newAdUrl);
6439
6529
  _this.totalAdsInBreak++;
6440
- _state.label = 6;
6441
- case 6:
6530
+ _this.continuousFetchQueueFullConsecutiveWaits = 0;
6531
+ _state.label = 8;
6532
+ case 8:
6442
6533
  generationDelay = _this.consecutiveFailures > 0 ? Math.min(1e3 * Math.pow(2, _this.consecutiveFailures), 5e3) : 500;
6443
6534
  return [
6444
6535
  4,
@@ -6446,7 +6537,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6446
6537
  return setTimeout(resolve, generationDelay);
6447
6538
  })
6448
6539
  ];
6449
- case 7:
6540
+ case 9:
6450
6541
  _state.sent();
6451
6542
  return [
6452
6543
  2
@@ -6454,33 +6545,41 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6454
6545
  }
6455
6546
  });
6456
6547
  };
6457
- _state.label = 1;
6458
- case 1:
6548
+ _state.label = 2;
6549
+ case 2:
6459
6550
  if (!(this.continuousFetchingActive && this.inAdBreak)) return [
6460
6551
  3,
6461
- 3
6552
+ 4
6462
6553
  ];
6463
6554
  _this = this;
6464
6555
  return [
6465
6556
  5,
6466
6557
  _ts_values(_loop())
6467
6558
  ];
6468
- case 2:
6559
+ case 3:
6469
6560
  _ret = _state.sent();
6470
6561
  if (_ret === "break") return [
6471
6562
  3,
6472
- 3
6563
+ 4
6473
6564
  ];
6474
6565
  return [
6475
6566
  3,
6476
- 1
6567
+ 2
6477
6568
  ];
6478
- case 3:
6569
+ case 4:
6570
+ return [
6571
+ 3,
6572
+ 6
6573
+ ];
6574
+ case 5:
6479
6575
  this.continuousFetchLoopRunning = false;
6576
+ this.continuousFetchQueueFullConsecutiveWaits = 0;
6577
+ return [
6578
+ 7
6579
+ ];
6580
+ case 6:
6480
6581
  if (this.config.debugAdTiming) {
6481
- console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 URL generation loop ended (queued: ".concat(this.adRequestQueue.length, ")"), this.adRequestQueue.length > 0 ? {
6482
- queuedUrls: _to_consumable_array(this.adRequestQueue)
6483
- } : {});
6582
+ this.logQueueState("URL generation loop ended");
6484
6583
  }
6485
6584
  return [
6486
6585
  2
@@ -6490,6 +6589,51 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6490
6589
  }).call(this);
6491
6590
  }
6492
6591
  },
6592
+ {
6593
+ key: "waitForQueueWithBackoff",
6594
+ value: function waitForQueueWithBackoff() {
6595
+ return _async_to_generator(function() {
6596
+ var delayMs, shouldLog;
6597
+ return _ts_generator(this, function(_state) {
6598
+ switch(_state.label){
6599
+ case 0:
6600
+ this.continuousFetchQueueFullConsecutiveWaits++;
6601
+ delayMs = Math.min(1e3 * Math.pow(2, this.continuousFetchQueueFullConsecutiveWaits - 1), 5e3);
6602
+ shouldLog = this.config.debugAdTiming && (this.continuousFetchQueueFullConsecutiveWaits <= 2 || this.continuousFetchQueueFullConsecutiveWaits % 4 === 0);
6603
+ if (shouldLog) {
6604
+ console.log("[CONTINUOUS-FETCH] ⏸️ URL queue full (".concat(this.adRequestQueue.length, "), waiting ").concat(delayMs, "ms (wait #").concat(this.continuousFetchQueueFullConsecutiveWaits, ")"));
6605
+ }
6606
+ return [
6607
+ 4,
6608
+ new Promise(function(resolve) {
6609
+ return setTimeout(resolve, delayMs);
6610
+ })
6611
+ ];
6612
+ case 1:
6613
+ _state.sent();
6614
+ return [
6615
+ 2
6616
+ ];
6617
+ }
6618
+ });
6619
+ }).call(this);
6620
+ }
6621
+ },
6622
+ {
6623
+ key: "logQueueState",
6624
+ value: function logQueueState(reason) {
6625
+ if (!this.config.debugAdTiming) return;
6626
+ console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 ".concat(reason), {
6627
+ queueLength: this.adRequestQueue.length,
6628
+ totalAdsInBreak: this.totalAdsInBreak,
6629
+ totalAdRequestsInBreak: this.totalAdRequestsInBreak,
6630
+ consecutiveFailures: this.consecutiveFailures,
6631
+ continuousFetchingActive: this.continuousFetchingActive,
6632
+ continuousFetchLoopRunning: this.continuousFetchLoopRunning,
6633
+ inAdBreak: this.inAdBreak
6634
+ });
6635
+ }
6636
+ },
6493
6637
  {
6494
6638
  key: "stopContinuousFetching",
6495
6639
  value: function stopContinuousFetching() {
@@ -6636,7 +6780,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6636
6780
  10
6637
6781
  ];
6638
6782
  nextAdUrl = this.adRequestQueue.shift();
6639
- if (!nextAdUrl) {
6783
+ if (nextAdUrl == null) {
6640
6784
  return [
6641
6785
  3,
6642
6786
  4
@@ -6660,8 +6804,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6660
6804
  4
6661
6805
  ];
6662
6806
  }
6807
+ console.log("[StormcloudVideoPlayer] Requesting next ad (%s), queue remaining=%s", nextAdUrl === "" ? "Prebid" : "VAST", this.adRequestQueue.length);
6663
6808
  if (this.config.debugAdTiming) {
6664
- console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC Requesting next ad via IMA SDK (".concat(this.currentAdIndex + 1, "/").concat(this.totalAdsInBreak, ", ").concat(this.adRequestQueue.length, " remaining in queue)"));
6809
+ console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC Requesting next ad via ".concat(this.getAdPlayerTypeLabel(), " (").concat(this.currentAdIndex + 1, "/").concat(this.totalAdsInBreak, ", ").concat(this.adRequestQueue.length, " remaining in queue)"));
6665
6810
  }
6666
6811
  currentMuted1 = this.video.muted;
6667
6812
  currentVolume1 = this.video.volume;
@@ -6822,7 +6967,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6822
6967
  9
6823
6968
  ];
6824
6969
  nextAdUrl = this.adRequestQueue.shift();
6825
- if (!nextAdUrl) {
6970
+ if (nextAdUrl == null) {
6826
6971
  return [
6827
6972
  3,
6828
6973
  3
@@ -6841,7 +6986,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6841
6986
  ];
6842
6987
  }
6843
6988
  if (this.config.debugAdTiming) {
6844
- console.log("[CONTINUOUS-FETCH] \u2705 Ad URL available, requesting via IMA SDK");
6989
+ console.log("[CONTINUOUS-FETCH] Ad URL available, requesting via ".concat(this.getAdPlayerTypeLabel()));
6845
6990
  }
6846
6991
  this.isShowingPlaceholder = false;
6847
6992
  this.ima.hidePlaceholder();
@@ -7027,11 +7172,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7027
7172
  {
7028
7173
  key: "ensureAdStoppedByTimer",
7029
7174
  value: function ensureAdStoppedByTimer() {
7175
+ var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
7030
7176
  if (!this.inAdBreak) return;
7031
7177
  this.adStopTimerId = void 0;
7032
7178
  var adPlaying = this.ima.isAdPlaying();
7033
7179
  var pendingAds = this.adPodQueue.length > 0;
7034
- var _this_config_adBreakCheckIntervalMs;
7035
7180
  var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
7036
7181
  var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
7037
7182
  var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
@@ -7039,7 +7184,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7039
7184
  if (this.currentAdBreakStartWallClockMs != null) {
7040
7185
  elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
7041
7186
  }
7042
- var _this_expectedAdBreakDurationMs;
7043
7187
  var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
7044
7188
  var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
7045
7189
  var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
@@ -7184,7 +7328,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7184
7328
  }
7185
7329
  throw new Error("Too many consecutive failures");
7186
7330
  }
7187
- this.recreateImaController();
7331
+ this.recreateAdController();
7188
7332
  requestToken = ++this.adRequestTokenCounter;
7189
7333
  this.activeAdRequestToken = requestToken;
7190
7334
  this.startAdRequestWatchdog(requestToken);
@@ -7296,15 +7440,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7296
7440
  9
7297
7441
  ];
7298
7442
  case 9:
7299
- if (this.isTemporaryAdError(playError)) {
7300
- this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7301
- if (this.config.debugAdTiming) {
7302
- console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
7303
- }
7304
- } else {
7305
- this.failedVastUrls.add(vastTagUrl);
7306
- if (this.config.debugAdTiming) {
7307
- console.log("[AD-ERROR] Permanent play error - URL blacklisted");
7443
+ if (vastTagUrl) {
7444
+ if (this.isTemporaryAdError(playError)) {
7445
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7446
+ if (this.config.debugAdTiming) {
7447
+ console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
7448
+ }
7449
+ } else {
7450
+ this.failedVastUrls.add(vastTagUrl);
7451
+ if (this.config.debugAdTiming) {
7452
+ console.log("[AD-ERROR] Permanent play error - URL blacklisted");
7453
+ }
7308
7454
  }
7309
7455
  }
7310
7456
  this.clearAdFailsafeTimer();
@@ -7373,15 +7519,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7373
7519
  15
7374
7520
  ];
7375
7521
  case 15:
7376
- if (this.isTemporaryAdError(error)) {
7377
- this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7378
- if (this.config.debugAdTiming) {
7379
- console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
7380
- }
7381
- } else {
7382
- this.failedVastUrls.add(vastTagUrl);
7383
- if (this.config.debugAdTiming) {
7384
- console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
7522
+ if (vastTagUrl) {
7523
+ if (this.isTemporaryAdError(error)) {
7524
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7525
+ if (this.config.debugAdTiming) {
7526
+ console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
7527
+ }
7528
+ } else {
7529
+ this.failedVastUrls.add(vastTagUrl);
7530
+ if (this.config.debugAdTiming) {
7531
+ console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
7532
+ }
7385
7533
  }
7386
7534
  }
7387
7535
  this.clearAdRequestWatchdog();
@@ -7425,6 +7573,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7425
7573
  this.showAds = false;
7426
7574
  this.currentAdIndex = 0;
7427
7575
  this.totalAdsInBreak = 0;
7576
+ this.totalAdRequestsInBreak = 0;
7428
7577
  this.consecutiveFailures = 0;
7429
7578
  this.ima.stop().catch(function() {});
7430
7579
  var restoredMuted = this.ima.getOriginalMutedState();
@@ -7436,17 +7585,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7436
7585
  this.video.volume = restoredVolume;
7437
7586
  }
7438
7587
  if (this.shouldContinueLiveStreamDuringAds()) {
7439
- if (this.video.paused) {
7440
- var _this_video_play;
7441
- if (this.config.debugAdTiming) {
7588
+ var _this_video_play;
7589
+ if (this.config.debugAdTiming) {
7590
+ if (this.video.paused) {
7442
7591
  console.log("[StormcloudVideoPlayer] Content video paused in live mode after ads, resuming playback");
7443
- }
7444
- (_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
7445
- } else {
7446
- if (this.config.debugAdTiming) {
7592
+ } else {
7447
7593
  console.log("[StormcloudVideoPlayer] Content video already playing in live mode after ads");
7448
7594
  }
7449
7595
  }
7596
+ (_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
7450
7597
  } else if (this.video.paused) {
7451
7598
  var _this_video_play1;
7452
7599
  (_this_video_play1 = this.video.play()) === null || _this_video_play1 === void 0 ? void 0 : _this_video_play1.catch(function() {});
@@ -7484,8 +7631,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7484
7631
  key: "startAdRequestWatchdog",
7485
7632
  value: function startAdRequestWatchdog(token) {
7486
7633
  var _this = this;
7487
- this.clearAdRequestWatchdog();
7488
7634
  var _this_config_adFailsafeTimeoutMs;
7635
+ this.clearAdRequestWatchdog();
7489
7636
  var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7490
7637
  this.adRequestWatchdogToken = token;
7491
7638
  this.adRequestWatchdogId = window.setTimeout(function() {
@@ -7528,8 +7675,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7528
7675
  key: "startAdFailsafeTimer",
7529
7676
  value: function startAdFailsafeTimer(token) {
7530
7677
  var _this = this;
7531
- this.clearAdFailsafeTimer();
7532
7678
  var _this_config_adFailsafeTimeoutMs;
7679
+ this.clearAdFailsafeTimer();
7533
7680
  var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7534
7681
  this.adFailsafeToken = token;
7535
7682
  this.adFailsafeTimerId = window.setTimeout(function() {
@@ -7910,21 +8057,21 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7910
8057
  var _React_useState14 = _sliced_to_array(React.useState(false), 2), showLicenseWarning = _React_useState14[0], setShowLicenseWarning = _React_useState14[1];
7911
8058
  var _React_useState15 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerWidth : 1920), 2), viewportWidth = _React_useState15[0], setViewportWidth = _React_useState15[1];
7912
8059
  var _React_useState16 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerHeight > window.innerWidth : false), 2), isPortrait = _React_useState16[0], setIsPortrait = _React_useState16[1];
7913
- var getResponsiveScale = function() {
8060
+ var getResponsiveScale = function getResponsiveScale() {
7914
8061
  if (viewportWidth < 480) return 0.7;
7915
8062
  if (viewportWidth < 768) return 0.8;
7916
8063
  if (viewportWidth < 1024) return 0.9;
7917
8064
  return 1;
7918
8065
  };
7919
8066
  var responsiveScale = getResponsiveScale();
7920
- var formatTime = function(seconds) {
8067
+ var formatTime = function formatTime(seconds) {
7921
8068
  if (!isFinite(seconds)) return "0:00:00";
7922
8069
  var hours = Math.floor(seconds / 3600);
7923
8070
  var minutes = Math.floor(seconds % 3600 / 60);
7924
8071
  var remainingSeconds = Math.floor(seconds % 60);
7925
8072
  return "".concat(hours, ":").concat(minutes.toString().padStart(2, "0"), ":").concat(remainingSeconds.toString().padStart(2, "0"));
7926
8073
  };
7927
- var handlePlayPause = function() {
8074
+ var handlePlayPause = function handlePlayPause() {
7928
8075
  if (videoRef.current) {
7929
8076
  if (videoRef.current.paused) {
7930
8077
  var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
@@ -7943,7 +8090,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7943
8090
  }
7944
8091
  }
7945
8092
  };
7946
- var handleCenterPlayClick = function() {
8093
+ var handleCenterPlayClick = function handleCenterPlayClick() {
7947
8094
  if (videoRef.current && videoRef.current.paused) {
7948
8095
  var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
7949
8096
  if (hasValidSource) {
@@ -7957,7 +8104,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7957
8104
  }
7958
8105
  }
7959
8106
  };
7960
- var handleTimelineSeek = function(e) {
8107
+ var handleTimelineSeek = function handleTimelineSeek(e) {
7961
8108
  if (videoRef.current && duration > 0 && isFinite(duration)) {
7962
8109
  var rect = e.currentTarget.getBoundingClientRect();
7963
8110
  var clickX = e.clientX - rect.left;
@@ -7968,13 +8115,13 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
7968
8115
  }
7969
8116
  }
7970
8117
  };
7971
- var handleVolumeChange = function(newVolume) {
8118
+ var handleVolumeChange = function handleVolumeChange(newVolume) {
7972
8119
  if (playerRef.current && isFinite(newVolume)) {
7973
8120
  var clampedVolume = Math.max(0, Math.min(1, newVolume));
7974
8121
  playerRef.current.setVolume(clampedVolume);
7975
8122
  }
7976
8123
  };
7977
- var handlePlaybackRateChange = function(rate) {
8124
+ var handlePlaybackRateChange = function handlePlaybackRateChange(rate) {
7978
8125
  if (videoRef.current && isFinite(rate) && rate > 0) {
7979
8126
  videoRef.current.playbackRate = rate;
7980
8127
  }
@@ -8012,7 +8159,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8012
8159
  if (playerRef.current) {
8013
8160
  try {
8014
8161
  playerRef.current.destroy();
8015
- } catch (e) {}
8162
+ } catch (unused) {}
8016
8163
  playerRef.current = null;
8017
8164
  }
8018
8165
  var cfg = {
@@ -8052,7 +8199,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8052
8199
  return function() {
8053
8200
  try {
8054
8201
  player.destroy();
8055
- } catch (e) {}
8202
+ } catch (unused) {}
8056
8203
  playerRef.current = null;
8057
8204
  };
8058
8205
  }, [
@@ -8076,7 +8223,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8076
8223
  ]);
8077
8224
  useEffect(function() {
8078
8225
  if (!playerRef.current) return;
8079
- var checkAdStatus = function() {
8226
+ var checkAdStatus = function checkAdStatus() {
8080
8227
  if (playerRef.current) {
8081
8228
  var _videoRef_current_dataset, _videoRef_current;
8082
8229
  var showAdsFromMethod = playerRef.current.isShowingAds();
@@ -8106,7 +8253,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8106
8253
  }, []);
8107
8254
  useEffect(function() {
8108
8255
  if (typeof window === "undefined" || !playerRef.current) return;
8109
- var handleResize = function() {
8256
+ var handleResize = function handleResize() {
8110
8257
  if (playerRef.current && videoRef.current) {
8111
8258
  if (typeof playerRef.current.resize === "function") {
8112
8259
  playerRef.current.resize();
@@ -8122,7 +8269,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8122
8269
  }, []);
8123
8270
  useEffect(function() {
8124
8271
  if (!playerRef.current || !videoRef.current) return;
8125
- var updateStates = function() {
8272
+ var updateStates = function updateStates() {
8126
8273
  var _videoRef_current;
8127
8274
  if (playerRef.current && videoRef.current) {
8128
8275
  setIsMuted(playerRef.current.isMuted());
@@ -8139,7 +8286,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8139
8286
  setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
8140
8287
  };
8141
8288
  var interval = setInterval(updateStates, 200);
8142
- var handleFullscreenChange = function() {
8289
+ var handleFullscreenChange = function handleFullscreenChange() {
8143
8290
  var _videoRef_current;
8144
8291
  setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
8145
8292
  };
@@ -8151,7 +8298,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8151
8298
  }, []);
8152
8299
  useEffect(function() {
8153
8300
  if (!videoRef.current) return;
8154
- var handleLoadedMetadata = function() {
8301
+ var handleLoadedMetadata = function handleLoadedMetadata() {
8155
8302
  if (videoRef.current) {
8156
8303
  var video2 = videoRef.current;
8157
8304
  void video2.offsetHeight;
@@ -8161,19 +8308,19 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8161
8308
  console.log("[StormcloudUI] Video event: loadedmetadata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
8162
8309
  }
8163
8310
  };
8164
- var handleLoadedData = function() {
8311
+ var handleLoadedData = function handleLoadedData() {
8165
8312
  if (debugAdTiming) {
8166
8313
  var _videoRef_current;
8167
8314
  console.log("[StormcloudUI] Video event: loadeddata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
8168
8315
  }
8169
8316
  };
8170
- var handleLoadStart = function() {
8317
+ var handleLoadStart = function handleLoadStart() {
8171
8318
  if (debugAdTiming) {
8172
8319
  var _videoRef_current;
8173
8320
  console.log("[StormcloudUI] Video event: loadstart, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
8174
8321
  }
8175
8322
  };
8176
- var handleCanPlay = function() {
8323
+ var handleCanPlay = function handleCanPlay() {
8177
8324
  setIsLoading(false);
8178
8325
  if (bufferingTimeoutRef.current) {
8179
8326
  clearTimeout(bufferingTimeoutRef.current);
@@ -8185,7 +8332,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8185
8332
  console.log("[StormcloudUI] Video event: canplay, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- clearing loading state, isLoading=false");
8186
8333
  }
8187
8334
  };
8188
- var handleCanPlayThrough = function() {
8335
+ var handleCanPlayThrough = function handleCanPlayThrough() {
8189
8336
  setIsLoading(false);
8190
8337
  if (bufferingTimeoutRef.current) {
8191
8338
  clearTimeout(bufferingTimeoutRef.current);
@@ -8197,7 +8344,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8197
8344
  console.log("[StormcloudUI] Video event: canplaythrough, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- clearing loading state, isLoading=false");
8198
8345
  }
8199
8346
  };
8200
- var handleWaiting = function() {
8347
+ var handleWaiting = function handleWaiting() {
8201
8348
  if (bufferingTimeoutRef.current) {
8202
8349
  clearTimeout(bufferingTimeoutRef.current);
8203
8350
  }
@@ -8213,7 +8360,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8213
8360
  console.log("[StormcloudUI] Video event: waiting, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- buffering delay started (300ms)");
8214
8361
  }
8215
8362
  };
8216
- var handlePlaying = function() {
8363
+ var handlePlaying = function handlePlaying() {
8217
8364
  setIsLoading(false);
8218
8365
  if (bufferingTimeoutRef.current) {
8219
8366
  clearTimeout(bufferingTimeoutRef.current);
@@ -8226,7 +8373,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8226
8373
  console.log("[StormcloudUI] Video event: playing, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- playback started, isLoading=false, isBuffering=false");
8227
8374
  }
8228
8375
  };
8229
- var handlePause = function() {
8376
+ var handlePause = function handlePause() {
8230
8377
  var _playerRef_current, _videoRef_current_dataset, _videoRef_current;
8231
8378
  var isAdActive = ((_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.isShowingAds()) || ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : (_videoRef_current_dataset = _videoRef_current.dataset) === null || _videoRef_current_dataset === void 0 ? void 0 : _videoRef_current_dataset.stormcloudAdPlaying) === "true";
8232
8379
  if (playerRef.current && !isAdActive) {
@@ -8235,7 +8382,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8235
8382
  setShowCenterPlay(false);
8236
8383
  }
8237
8384
  };
8238
- var handleEnded = function() {
8385
+ var handleEnded = function handleEnded() {
8239
8386
  setShowCenterPlay(true);
8240
8387
  };
8241
8388
  var video = videoRef.current;
@@ -8393,14 +8540,14 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8393
8540
  boxShadow: "0 12px 40px rgba(0, 0, 0, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.3)",
8394
8541
  transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
8395
8542
  },
8396
- onMouseEnter: function(e) {
8543
+ onMouseEnter: function onMouseEnter(e) {
8397
8544
  var target = e.currentTarget;
8398
8545
  target.style.transform = "translate(-50%, -50%)";
8399
8546
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(40, 40, 40, 0.9) 100%)";
8400
8547
  target.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.9), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
8401
8548
  target.style.borderColor = "rgba(255, 255, 255, 0.9)";
8402
8549
  },
8403
- onMouseLeave: function(e) {
8550
+ onMouseLeave: function onMouseLeave(e) {
8404
8551
  var target = e.currentTarget;
8405
8552
  target.style.transform = "translate(-50%, -50%)";
8406
8553
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.8) 100%)";
@@ -8507,12 +8654,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8507
8654
  minWidth: "".concat(48 * responsiveScale, "px"),
8508
8655
  minHeight: "".concat(48 * responsiveScale, "px")
8509
8656
  },
8510
- onMouseEnter: function(e) {
8657
+ onMouseEnter: function onMouseEnter(e) {
8511
8658
  var target = e.target;
8512
8659
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
8513
8660
  target.style.boxShadow = "0 12px 48px rgba(0, 0, 0, 0.6), 0 6px 24px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
8514
8661
  },
8515
- onMouseLeave: function(e) {
8662
+ onMouseLeave: function onMouseLeave(e) {
8516
8663
  var target = e.target;
8517
8664
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
8518
8665
  target.style.boxShadow = "0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
@@ -8538,15 +8685,15 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8538
8685
  padding: "8px",
8539
8686
  margin: "-8px"
8540
8687
  },
8541
- onMouseEnter: function() {
8688
+ onMouseEnter: function onMouseEnter() {
8542
8689
  return setShowVolumeSlider(true);
8543
8690
  },
8544
- onMouseLeave: function() {
8691
+ onMouseLeave: function onMouseLeave() {
8545
8692
  return setShowVolumeSlider(false);
8546
8693
  },
8547
8694
  children: [
8548
8695
  /* @__PURE__ */ jsx("button", {
8549
- onClick: function() {
8696
+ onClick: function onClick() {
8550
8697
  if (playerRef.current) {
8551
8698
  playerRef.current.toggleMute();
8552
8699
  }
@@ -8570,12 +8717,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8570
8717
  minWidth: "".concat(44 * responsiveScale, "px"),
8571
8718
  minHeight: "".concat(44 * responsiveScale, "px")
8572
8719
  },
8573
- onMouseEnter: function(e) {
8720
+ onMouseEnter: function onMouseEnter(e) {
8574
8721
  var target = e.target;
8575
8722
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
8576
8723
  target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
8577
8724
  },
8578
- onMouseLeave: function(e) {
8725
+ onMouseLeave: function onMouseLeave(e) {
8579
8726
  var target = e.target;
8580
8727
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
8581
8728
  target.style.boxShadow = "0 6px 28px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
@@ -8611,10 +8758,10 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8611
8758
  marginBottom: "-16px",
8612
8759
  zIndex: 9
8613
8760
  },
8614
- onMouseEnter: function() {
8761
+ onMouseEnter: function onMouseEnter() {
8615
8762
  return setShowVolumeSlider(true);
8616
8763
  },
8617
- onMouseLeave: function() {
8764
+ onMouseLeave: function onMouseLeave() {
8618
8765
  return setShowVolumeSlider(false);
8619
8766
  }
8620
8767
  }),
@@ -8639,12 +8786,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8639
8786
  zIndex: 10,
8640
8787
  transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
8641
8788
  },
8642
- onMouseEnter: function(e) {
8789
+ onMouseEnter: function onMouseEnter(e) {
8643
8790
  setShowVolumeSlider(true);
8644
8791
  e.currentTarget.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.6), 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 24px rgba(59, 130, 246, 0.3)";
8645
8792
  e.currentTarget.style.borderColor = "rgba(59, 130, 246, 0.4)";
8646
8793
  },
8647
- onMouseLeave: function(e) {
8794
+ onMouseLeave: function onMouseLeave(e) {
8648
8795
  setShowVolumeSlider(false);
8649
8796
  e.currentTarget.style.boxShadow = "0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15)";
8650
8797
  e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.15)";
@@ -8657,19 +8804,19 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8657
8804
  cursor: "pointer",
8658
8805
  transition: "transform 0.2s ease-in-out"
8659
8806
  },
8660
- onMouseEnter: function(e) {},
8661
- onMouseLeave: function(e) {},
8662
- onMouseDown: function(e) {
8807
+ onMouseEnter: function onMouseEnter(e) {},
8808
+ onMouseLeave: function onMouseLeave(e) {},
8809
+ onMouseDown: function onMouseDown(e) {
8663
8810
  e.preventDefault();
8664
8811
  var sliderElement = e.currentTarget;
8665
- var handleMouseMove = function(moveEvent) {
8812
+ var handleMouseMove = function handleMouseMove(moveEvent) {
8666
8813
  if (!sliderElement) return;
8667
8814
  var rect2 = sliderElement.getBoundingClientRect();
8668
8815
  var y2 = moveEvent.clientY - rect2.top;
8669
8816
  var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
8670
8817
  handleVolumeChange(percentage2);
8671
8818
  };
8672
- var handleMouseUp = function() {
8819
+ var handleMouseUp = function handleMouseUp1() {
8673
8820
  document.removeEventListener("mousemove", handleMouseMove);
8674
8821
  document.removeEventListener("mouseup", handleMouseUp);
8675
8822
  };
@@ -8680,7 +8827,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8680
8827
  var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
8681
8828
  handleVolumeChange(percentage);
8682
8829
  },
8683
- onClick: function(e) {
8830
+ onClick: function onClick(e) {
8684
8831
  e.stopPropagation();
8685
8832
  var rect = e.currentTarget.getBoundingClientRect();
8686
8833
  var y = e.clientY - rect.top;
@@ -8727,17 +8874,17 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8727
8874
  transition: "bottom 0.15s ease-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, width 0.2s ease-in-out, height 0.2s ease-in-out",
8728
8875
  cursor: "grab"
8729
8876
  },
8730
- onMouseEnter: function(e) {
8877
+ onMouseEnter: function onMouseEnter(e) {
8731
8878
  e.currentTarget.style.boxShadow = "0 3px 10px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(59, 130, 246, 0.5), 0 0 20px rgba(59, 130, 246, 0.6)";
8732
8879
  e.currentTarget.style.cursor = "grab";
8733
8880
  },
8734
- onMouseLeave: function(e) {
8881
+ onMouseLeave: function onMouseLeave(e) {
8735
8882
  e.currentTarget.style.boxShadow = "0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(59, 130, 246, 0.3), 0 0 12px rgba(59, 130, 246, 0.4)";
8736
8883
  },
8737
- onMouseDown: function(e) {
8884
+ onMouseDown: function onMouseDown(e) {
8738
8885
  e.currentTarget.style.cursor = "grabbing";
8739
8886
  },
8740
- onMouseUp: function(e) {
8887
+ onMouseUp: function onMouseUp(e) {
8741
8888
  e.currentTarget.style.cursor = "grab";
8742
8889
  }
8743
8890
  })
@@ -8777,7 +8924,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8777
8924
  },
8778
8925
  children: [
8779
8926
  /* @__PURE__ */ jsxs("button", {
8780
- onClick: function() {
8927
+ onClick: function onClick() {
8781
8928
  return setShowSpeedMenu(!showSpeedMenu);
8782
8929
  },
8783
8930
  style: {
@@ -8796,12 +8943,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8796
8943
  minWidth: "".concat(56 * responsiveScale, "px"),
8797
8944
  minHeight: "".concat(40 * responsiveScale, "px")
8798
8945
  },
8799
- onMouseEnter: function(e) {
8946
+ onMouseEnter: function onMouseEnter(e) {
8800
8947
  var target = e.target;
8801
8948
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
8802
8949
  target.style.boxShadow = "0 10px 32px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
8803
8950
  },
8804
- onMouseLeave: function(e) {
8951
+ onMouseLeave: function onMouseLeave(e) {
8805
8952
  var target = e.target;
8806
8953
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
8807
8954
  target.style.boxShadow = "0 6px 24px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
@@ -8837,7 +8984,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8837
8984
  2
8838
8985
  ].map(function(speed) {
8839
8986
  return /* @__PURE__ */ jsxs("button", {
8840
- onClick: function() {
8987
+ onClick: function onClick() {
8841
8988
  return handlePlaybackRateChange(speed);
8842
8989
  },
8843
8990
  style: {
@@ -8855,12 +9002,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8855
9002
  transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
8856
9003
  borderBottom: speed !== 2 ? "1px solid rgba(255, 255, 255, 0.05)" : "none"
8857
9004
  },
8858
- onMouseEnter: function(e) {
9005
+ onMouseEnter: function onMouseEnter(e) {
8859
9006
  if (playbackRate !== speed) {
8860
9007
  e.target.style.background = "linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%)";
8861
9008
  }
8862
9009
  },
8863
- onMouseLeave: function(e) {
9010
+ onMouseLeave: function onMouseLeave(e) {
8864
9011
  if (playbackRate !== speed) {
8865
9012
  e.target.style.background = "transparent";
8866
9013
  }
@@ -8875,7 +9022,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8875
9022
  ]
8876
9023
  }),
8877
9024
  /* @__PURE__ */ jsx("button", {
8878
- onClick: function() {
9025
+ onClick: function onClick() {
8879
9026
  if (onFullscreenToggle) {
8880
9027
  onFullscreenToggle();
8881
9028
  } else if (playerRef.current) {
@@ -8900,12 +9047,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8900
9047
  minWidth: "".concat(44 * responsiveScale, "px"),
8901
9048
  minHeight: "".concat(44 * responsiveScale, "px")
8902
9049
  },
8903
- onMouseEnter: function(e) {
9050
+ onMouseEnter: function onMouseEnter(e) {
8904
9051
  var target = e.target;
8905
9052
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
8906
9053
  target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
8907
9054
  },
8908
- onMouseLeave: function(e) {
9055
+ onMouseLeave: function onMouseLeave(e) {
8909
9056
  var target = e.target;
8910
9057
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
8911
9058
  target.style.boxShadow = "0 6px 28px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
@@ -8949,15 +9096,15 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8949
9096
  padding: "8px",
8950
9097
  margin: "-8px"
8951
9098
  },
8952
- onMouseEnter: function() {
9099
+ onMouseEnter: function onMouseEnter() {
8953
9100
  return setShowVolumeSlider(true);
8954
9101
  },
8955
- onMouseLeave: function() {
9102
+ onMouseLeave: function onMouseLeave() {
8956
9103
  return setShowVolumeSlider(false);
8957
9104
  },
8958
9105
  children: [
8959
9106
  /* @__PURE__ */ jsx("button", {
8960
- onClick: function() {
9107
+ onClick: function onClick() {
8961
9108
  if (playerRef.current) {
8962
9109
  playerRef.current.toggleMute();
8963
9110
  }
@@ -8965,12 +9112,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
8965
9112
  onVolumeToggle();
8966
9113
  }
8967
9114
  },
8968
- onMouseEnter: function(e) {
9115
+ onMouseEnter: function onMouseEnter(e) {
8969
9116
  var target = e.currentTarget;
8970
9117
  target.style.boxShadow = "0 14px 48px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(255, 255, 255, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
8971
9118
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
8972
9119
  },
8973
- onMouseLeave: function(e) {
9120
+ onMouseLeave: function onMouseLeave(e) {
8974
9121
  var target = e.currentTarget;
8975
9122
  target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
8976
9123
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
@@ -9025,10 +9172,10 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
9025
9172
  marginBottom: "-16px",
9026
9173
  zIndex: 9
9027
9174
  },
9028
- onMouseEnter: function() {
9175
+ onMouseEnter: function onMouseEnter() {
9029
9176
  return setShowVolumeSlider(true);
9030
9177
  },
9031
- onMouseLeave: function() {
9178
+ onMouseLeave: function onMouseLeave() {
9032
9179
  return setShowVolumeSlider(false);
9033
9180
  }
9034
9181
  }),
@@ -9053,12 +9200,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
9053
9200
  zIndex: 10,
9054
9201
  transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
9055
9202
  },
9056
- onMouseEnter: function(e) {
9203
+ onMouseEnter: function onMouseEnter(e) {
9057
9204
  setShowVolumeSlider(true);
9058
9205
  e.currentTarget.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.9), 0 6px 16px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 24px rgba(96, 165, 250, 0.4)";
9059
9206
  e.currentTarget.style.borderColor = "rgba(96, 165, 250, 0.8)";
9060
9207
  },
9061
- onMouseLeave: function(e) {
9208
+ onMouseLeave: function onMouseLeave(e) {
9062
9209
  setShowVolumeSlider(false);
9063
9210
  e.currentTarget.style.boxShadow = "0 12px 40px rgba(0, 0, 0, 0.85), 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35)";
9064
9211
  e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.7)";
@@ -9071,17 +9218,17 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
9071
9218
  cursor: "pointer",
9072
9219
  transition: "transform 0.2s ease-in-out"
9073
9220
  },
9074
- onMouseDown: function(e) {
9221
+ onMouseDown: function onMouseDown(e) {
9075
9222
  e.preventDefault();
9076
9223
  var sliderElement = e.currentTarget;
9077
- var handleMouseMove = function(moveEvent) {
9224
+ var handleMouseMove = function handleMouseMove(moveEvent) {
9078
9225
  if (!sliderElement) return;
9079
9226
  var rect2 = sliderElement.getBoundingClientRect();
9080
9227
  var y2 = moveEvent.clientY - rect2.top;
9081
9228
  var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
9082
9229
  handleVolumeChange(percentage2);
9083
9230
  };
9084
- var handleMouseUp = function() {
9231
+ var handleMouseUp = function handleMouseUp1() {
9085
9232
  document.removeEventListener("mousemove", handleMouseMove);
9086
9233
  document.removeEventListener("mouseup", handleMouseUp);
9087
9234
  };
@@ -9092,7 +9239,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
9092
9239
  var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
9093
9240
  handleVolumeChange(percentage);
9094
9241
  },
9095
- onClick: function(e) {
9242
+ onClick: function onClick(e) {
9096
9243
  e.stopPropagation();
9097
9244
  var rect = e.currentTarget.getBoundingClientRect();
9098
9245
  var y = e.clientY - rect.top;
@@ -9141,17 +9288,17 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
9141
9288
  transition: "bottom 0.15s ease-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, width 0.2s ease-in-out, height 0.2s ease-in-out",
9142
9289
  cursor: "grab"
9143
9290
  },
9144
- onMouseEnter: function(e) {
9291
+ onMouseEnter: function onMouseEnter(e) {
9145
9292
  e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(96, 165, 250, 0.6), 0 0 24px rgba(96, 165, 250, 0.7)";
9146
9293
  e.currentTarget.style.cursor = "grab";
9147
9294
  },
9148
- onMouseLeave: function(e) {
9295
+ onMouseLeave: function onMouseLeave(e) {
9149
9296
  e.currentTarget.style.boxShadow = "0 3px 8px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(96, 165, 250, 0.4), 0 0 16px rgba(96, 165, 250, 0.5)";
9150
9297
  },
9151
- onMouseDown: function(e) {
9298
+ onMouseDown: function onMouseDown(e) {
9152
9299
  e.currentTarget.style.cursor = "grabbing";
9153
9300
  },
9154
- onMouseUp: function(e) {
9301
+ onMouseUp: function onMouseUp(e) {
9155
9302
  e.currentTarget.style.cursor = "grab";
9156
9303
  }
9157
9304
  })
@@ -9163,7 +9310,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
9163
9310
  ]
9164
9311
  }),
9165
9312
  /* @__PURE__ */ jsx("button", {
9166
- onClick: function() {
9313
+ onClick: function onClick() {
9167
9314
  if (onFullscreenToggle) {
9168
9315
  onFullscreenToggle();
9169
9316
  } else if (playerRef.current) {
@@ -9172,12 +9319,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
9172
9319
  });
9173
9320
  }
9174
9321
  },
9175
- onMouseEnter: function(e) {
9322
+ onMouseEnter: function onMouseEnter(e) {
9176
9323
  var target = e.currentTarget;
9177
9324
  target.style.boxShadow = "0 14px 48px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(255, 255, 255, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
9178
9325
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
9179
9326
  },
9180
- onMouseLeave: function(e) {
9327
+ onMouseLeave: function onMouseLeave(e) {
9181
9328
  var target = e.currentTarget;
9182
9329
  target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
9183
9330
  target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
@@ -9323,7 +9470,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
9323
9470
  // src/StormcloudPlayer.tsx
9324
9471
  import React3, { Component as Component4, Suspense } from "react";
9325
9472
  // src/props.ts
9326
- var noop = function() {};
9473
+ var noop = function noop() {};
9327
9474
  var defaultProps = {
9328
9475
  playing: false,
9329
9476
  loop: false,
@@ -9369,29 +9516,29 @@ var defaultProps = {
9369
9516
  // src/utils.ts
9370
9517
  import { lazy as reactLazy } from "react";
9371
9518
  var lazy = reactLazy;
9372
- var omit = function(object, keys) {
9519
+ var omit = function omit(object, keys) {
9373
9520
  var result = _object_spread({}, object);
9374
9521
  keys.forEach(function(key) {
9375
9522
  delete result[key];
9376
9523
  });
9377
9524
  return result;
9378
9525
  };
9379
- var isMediaStream = function(url) {
9526
+ var isMediaStream = function isMediaStream(url) {
9380
9527
  return typeof window !== "undefined" && window.MediaStream && _instanceof(url, window.MediaStream);
9381
9528
  };
9382
- var supportsWebKitPresentationMode = function() {
9529
+ var supportsWebKitPresentationMode = function supportsWebKitPresentationMode() {
9383
9530
  if (typeof window === "undefined") return false;
9384
9531
  var video = document.createElement("video");
9385
9532
  return "webkitSupportsPresentationMode" in video;
9386
9533
  };
9387
- var randomString = function() {
9534
+ var randomString = function randomString() {
9388
9535
  return Math.random().toString(36).substr(2, 9);
9389
9536
  };
9390
- var parseQuery = function(url) {
9537
+ var parseQuery = function parseQuery(url) {
9391
9538
  var query = {};
9392
9539
  var queryString = url.split("?")[1] || "";
9393
9540
  if (!queryString) return query;
9394
- var manualParse = function(qs) {
9541
+ var manualParse = function manualParse(qs) {
9395
9542
  qs.split("&").forEach(function(param) {
9396
9543
  var _param_split = _sliced_to_array(param.split("="), 2), key = _param_split[0], value = _param_split[1];
9397
9544
  if (key) {
@@ -9418,7 +9565,7 @@ var parseQuery = function(url) {
9418
9565
  }
9419
9566
  return query;
9420
9567
  };
9421
- var merge = function(target) {
9568
+ var merge = function merge1(target) {
9422
9569
  for(var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
9423
9570
  sources[_key - 1] = arguments[_key];
9424
9571
  }
@@ -9438,19 +9585,19 @@ var merge = function(target) {
9438
9585
  target
9439
9586
  ].concat(_to_consumable_array(sources)));
9440
9587
  };
9441
- var isObject = function(item) {
9588
+ var isObject = function isObject(item) {
9442
9589
  return item && (typeof item === "undefined" ? "undefined" : _type_of(item)) === "object" && !Array.isArray(item);
9443
9590
  };
9444
9591
  var IS_BROWSER = typeof window !== "undefined" && window.document;
9445
9592
  var IS_GLOBAL = typeof globalThis !== "undefined" && globalThis.window && globalThis.window.document;
9446
9593
  var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(navigator.userAgent);
9447
9594
  var IS_SAFARI = IS_BROWSER && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
9448
- var SUPPORTS_HLS = function() {
9595
+ var SUPPORTS_HLS = function SUPPORTS_HLS() {
9449
9596
  if (!IS_BROWSER) return false;
9450
9597
  var video = document.createElement("video");
9451
9598
  return Boolean(video.canPlayType("application/vnd.apple.mpegurl"));
9452
9599
  };
9453
- var SUPPORTS_DASH = function() {
9600
+ var SUPPORTS_DASH = function SUPPORTS_DASH() {
9454
9601
  if (!IS_BROWSER) return false;
9455
9602
  var video = document.createElement("video");
9456
9603
  return Boolean(video.canPlayType("application/dash+xml"));
@@ -9462,23 +9609,23 @@ var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
9462
9609
  var VIDEO_EXTENSIONS = /\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\?)/i;
9463
9610
  var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\?)/i;
9464
9611
  var canPlay = {
9465
- hls: function(url) {
9612
+ hls: function hls(url) {
9466
9613
  if (!url || typeof url !== "string") return false;
9467
9614
  return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);
9468
9615
  },
9469
- dash: function(url) {
9616
+ dash: function dash(url) {
9470
9617
  if (!url || typeof url !== "string") return false;
9471
9618
  return DASH_EXTENSIONS.test(url);
9472
9619
  },
9473
- video: function(url) {
9620
+ video: function video(url) {
9474
9621
  if (!url || typeof url !== "string") return false;
9475
9622
  return VIDEO_EXTENSIONS.test(url);
9476
9623
  },
9477
- audio: function(url) {
9624
+ audio: function audio(url) {
9478
9625
  if (!url || typeof url !== "string") return false;
9479
9626
  return AUDIO_EXTENSIONS.test(url);
9480
9627
  },
9481
- file: function(url) {
9628
+ file: function file(url) {
9482
9629
  if (!url || typeof url !== "string") return false;
9483
9630
  return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);
9484
9631
  }
@@ -9491,11 +9638,11 @@ var HlsPlayer = /*#__PURE__*/ function(Component) {
9491
9638
  function HlsPlayer() {
9492
9639
  _class_call_check(this, HlsPlayer);
9493
9640
  var _this;
9494
- var _this1, _arguments = arguments;
9495
- _this = _call_super(this, HlsPlayer, _to_consumable_array(_arguments)), _this1 = _this;
9496
- _this1.player = null;
9497
- _this1.mounted = false;
9498
- _this1.load = function() {
9641
+ var _this1;
9642
+ _this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
9643
+ _this.player = null;
9644
+ _this.mounted = false;
9645
+ _this.load = function() {
9499
9646
  return _async_to_generator(function() {
9500
9647
  var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
9501
9648
  return _ts_generator(this, function(_state) {
@@ -9568,87 +9715,87 @@ var HlsPlayer = /*#__PURE__*/ function(Component) {
9568
9715
  });
9569
9716
  })();
9570
9717
  };
9571
- _this1.play = function() {
9572
- if (_this1.props.videoElement) {
9573
- var video = _this1.props.videoElement;
9718
+ _this.play = function() {
9719
+ if (_this.props.videoElement) {
9720
+ var video = _this.props.videoElement;
9574
9721
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
9575
9722
  if (hasValidSource) {
9576
9723
  var _video_play, _this_props_onPlay, _this_props;
9577
9724
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
9578
9725
  var _this_props_onError, _this_props;
9579
9726
  console.error("[HlsPlayer] Failed to play:", error);
9580
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
9727
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
9581
9728
  });
9582
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
9729
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
9583
9730
  } else {
9584
9731
  console.warn("[HlsPlayer] Cannot play: video has no valid source");
9585
9732
  }
9586
9733
  }
9587
9734
  };
9588
- _this1.pause = function() {
9589
- if (_this1.props.videoElement) {
9735
+ _this.pause = function() {
9736
+ if (_this.props.videoElement) {
9590
9737
  var _this_props_onPause, _this_props;
9591
- _this1.props.videoElement.pause();
9592
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
9738
+ _this.props.videoElement.pause();
9739
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
9593
9740
  }
9594
9741
  };
9595
- _this1.stop = function() {
9596
- _this1.pause();
9597
- if (_this1.props.videoElement) {
9598
- _this1.props.videoElement.currentTime = 0;
9742
+ _this.stop = function() {
9743
+ _this.pause();
9744
+ if (_this.props.videoElement) {
9745
+ _this.props.videoElement.currentTime = 0;
9599
9746
  }
9600
9747
  };
9601
- _this1.seekTo = function(seconds, keepPlaying) {
9602
- if (_this1.props.videoElement) {
9603
- _this1.props.videoElement.currentTime = seconds;
9748
+ _this.seekTo = function(seconds, keepPlaying) {
9749
+ if (_this.props.videoElement) {
9750
+ _this.props.videoElement.currentTime = seconds;
9604
9751
  if (!keepPlaying) {
9605
- _this1.pause();
9752
+ _this.pause();
9606
9753
  }
9607
9754
  }
9608
9755
  };
9609
- _this1.setVolume = function(volume) {
9610
- if (_this1.props.videoElement) {
9611
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
9756
+ _this.setVolume = function(volume) {
9757
+ if (_this.props.videoElement) {
9758
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
9612
9759
  }
9613
9760
  };
9614
- _this1.mute = function() {
9615
- if (_this1.props.videoElement) {
9616
- _this1.props.videoElement.muted = true;
9761
+ _this.mute = function() {
9762
+ if (_this.props.videoElement) {
9763
+ _this.props.videoElement.muted = true;
9617
9764
  }
9618
9765
  };
9619
- _this1.unmute = function() {
9620
- if (_this1.props.videoElement) {
9621
- _this1.props.videoElement.muted = false;
9766
+ _this.unmute = function() {
9767
+ if (_this.props.videoElement) {
9768
+ _this.props.videoElement.muted = false;
9622
9769
  }
9623
9770
  };
9624
- _this1.setPlaybackRate = function(rate) {
9625
- if (_this1.props.videoElement && rate > 0) {
9626
- _this1.props.videoElement.playbackRate = rate;
9771
+ _this.setPlaybackRate = function(rate) {
9772
+ if (_this.props.videoElement && rate > 0) {
9773
+ _this.props.videoElement.playbackRate = rate;
9627
9774
  }
9628
9775
  };
9629
- _this1.getDuration = function() {
9630
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
9631
- return _this1.props.videoElement.duration;
9776
+ _this.getDuration = function() {
9777
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
9778
+ return _this.props.videoElement.duration;
9632
9779
  }
9633
9780
  return null;
9634
9781
  };
9635
- _this1.getCurrentTime = function() {
9636
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
9637
- return _this1.props.videoElement.currentTime;
9782
+ _this.getCurrentTime = function() {
9783
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
9784
+ return _this.props.videoElement.currentTime;
9638
9785
  }
9639
9786
  return null;
9640
9787
  };
9641
- _this1.getSecondsLoaded = function() {
9642
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
9643
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
9788
+ _this.getSecondsLoaded = function() {
9789
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
9790
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
9644
9791
  }
9645
9792
  return null;
9646
9793
  };
9647
- _this1.getInternalPlayer = function() {
9794
+ _this.getInternalPlayer = function() {
9648
9795
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
9649
- if (key === "player") return _this1.player;
9650
- if (key === "video") return _this1.props.videoElement;
9651
- if (key === "hls" && _this1.player) return _this1.player.hls;
9796
+ if (key === "player") return _this.player;
9797
+ if (key === "video") return _this.props.videoElement;
9798
+ if (key === "hls" && _this.player) return _this.player.hls;
9652
9799
  return null;
9653
9800
  };
9654
9801
  return _this;
@@ -9698,49 +9845,49 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
9698
9845
  function FilePlayer() {
9699
9846
  _class_call_check(this, FilePlayer);
9700
9847
  var _this;
9701
- var _this1, _arguments = arguments;
9702
- _this = _call_super(this, FilePlayer, _to_consumable_array(_arguments)), _this1 = _this;
9703
- _this1.mounted = false;
9704
- _this1.ready = false;
9705
- _this1.load = function() {
9848
+ var _this1;
9849
+ _this = _call_super(this, FilePlayer, arguments), _this1 = _this;
9850
+ _this.mounted = false;
9851
+ _this.ready = false;
9852
+ _this.load = function() {
9706
9853
  var _this_props_onMount, _this_props;
9707
- if (!_this1.props.videoElement || !_this1.props.src) return;
9708
- var video = _this1.props.videoElement;
9709
- var handleLoadedMetadata = function() {
9710
- if (_this1.mounted && !_this1.ready) {
9854
+ if (!_this.props.videoElement || !_this.props.src) return;
9855
+ var video = _this.props.videoElement;
9856
+ var handleLoadedMetadata = function handleLoadedMetadata() {
9857
+ if (_this.mounted && !_this.ready) {
9711
9858
  var _this_props_onReady, _this_props;
9712
- _this1.ready = true;
9713
- (_this_props_onReady = (_this_props = _this1.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
9859
+ _this.ready = true;
9860
+ (_this_props_onReady = (_this_props = _this.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
9714
9861
  }
9715
9862
  };
9716
- var handlePlay = function() {
9717
- if (_this1.mounted) {
9863
+ var handlePlay = function handlePlay() {
9864
+ if (_this.mounted) {
9718
9865
  var _this_props_onPlay, _this_props;
9719
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
9866
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
9720
9867
  }
9721
9868
  };
9722
- var handlePause = function() {
9723
- if (_this1.mounted) {
9869
+ var handlePause = function handlePause() {
9870
+ if (_this.mounted) {
9724
9871
  var _this_props_onPause, _this_props;
9725
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
9872
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
9726
9873
  }
9727
9874
  };
9728
- var handleEnded = function() {
9729
- if (_this1.mounted) {
9875
+ var handleEnded = function handleEnded() {
9876
+ if (_this.mounted) {
9730
9877
  var _this_props_onEnded, _this_props;
9731
- (_this_props_onEnded = (_this_props = _this1.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
9878
+ (_this_props_onEnded = (_this_props = _this.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
9732
9879
  }
9733
9880
  };
9734
- var handleError = function(error) {
9735
- if (_this1.mounted) {
9881
+ var handleError = function handleError(error) {
9882
+ if (_this.mounted) {
9736
9883
  var _this_props_onError, _this_props;
9737
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
9884
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
9738
9885
  }
9739
9886
  };
9740
- var handleLoadedData = function() {
9741
- if (_this1.mounted) {
9887
+ var handleLoadedData = function handleLoadedData() {
9888
+ if (_this.mounted) {
9742
9889
  var _this_props_onLoaded, _this_props;
9743
- (_this_props_onLoaded = (_this_props = _this1.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
9890
+ (_this_props_onLoaded = (_this_props = _this.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
9744
9891
  }
9745
9892
  };
9746
9893
  video.addEventListener("loadedmetadata", handleLoadedMetadata);
@@ -9749,15 +9896,15 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
9749
9896
  video.addEventListener("ended", handleEnded);
9750
9897
  video.addEventListener("error", handleError);
9751
9898
  video.addEventListener("loadeddata", handleLoadedData);
9752
- video.src = _this1.props.src;
9753
- if (_this1.props.autoplay !== void 0) video.autoplay = _this1.props.autoplay;
9754
- if (_this1.props.muted !== void 0) video.muted = _this1.props.muted;
9755
- if (_this1.props.loop !== void 0) video.loop = _this1.props.loop;
9756
- if (_this1.props.controls !== void 0) video.controls = _this1.props.controls;
9757
- if (_this1.props.playsInline !== void 0) video.playsInline = _this1.props.playsInline;
9758
- if (_this1.props.preload !== void 0) video.preload = _this1.props.preload;
9759
- if (_this1.props.poster !== void 0) video.poster = _this1.props.poster;
9760
- (_this_props_onMount = (_this_props = _this1.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this1);
9899
+ video.src = _this.props.src;
9900
+ if (_this.props.autoplay !== void 0) video.autoplay = _this.props.autoplay;
9901
+ if (_this.props.muted !== void 0) video.muted = _this.props.muted;
9902
+ if (_this.props.loop !== void 0) video.loop = _this.props.loop;
9903
+ if (_this.props.controls !== void 0) video.controls = _this.props.controls;
9904
+ if (_this.props.playsInline !== void 0) video.playsInline = _this.props.playsInline;
9905
+ if (_this.props.preload !== void 0) video.preload = _this.props.preload;
9906
+ if (_this.props.poster !== void 0) video.poster = _this.props.poster;
9907
+ (_this_props_onMount = (_this_props = _this.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this);
9761
9908
  return function() {
9762
9909
  video.removeEventListener("loadedmetadata", handleLoadedMetadata);
9763
9910
  video.removeEventListener("play", handlePlay);
@@ -9767,90 +9914,90 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
9767
9914
  video.removeEventListener("loadeddata", handleLoadedData);
9768
9915
  };
9769
9916
  };
9770
- _this1.play = function() {
9771
- if (_this1.props.videoElement) {
9772
- var video = _this1.props.videoElement;
9917
+ _this.play = function() {
9918
+ if (_this.props.videoElement) {
9919
+ var video = _this.props.videoElement;
9773
9920
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
9774
9921
  if (hasValidSource) {
9775
9922
  var _video_play;
9776
9923
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
9777
9924
  var _this_props_onError, _this_props;
9778
9925
  console.error("[FilePlayer] Failed to play:", error);
9779
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
9926
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
9780
9927
  });
9781
9928
  } else {
9782
9929
  console.warn("[FilePlayer] Cannot play: video has no valid source");
9783
9930
  }
9784
9931
  }
9785
9932
  };
9786
- _this1.pause = function() {
9787
- if (_this1.props.videoElement) {
9788
- _this1.props.videoElement.pause();
9933
+ _this.pause = function() {
9934
+ if (_this.props.videoElement) {
9935
+ _this.props.videoElement.pause();
9789
9936
  }
9790
9937
  };
9791
- _this1.stop = function() {
9792
- _this1.pause();
9793
- if (_this1.props.videoElement) {
9794
- _this1.props.videoElement.currentTime = 0;
9938
+ _this.stop = function() {
9939
+ _this.pause();
9940
+ if (_this.props.videoElement) {
9941
+ _this.props.videoElement.currentTime = 0;
9795
9942
  }
9796
9943
  };
9797
- _this1.seekTo = function(seconds, keepPlaying) {
9798
- if (_this1.props.videoElement) {
9799
- _this1.props.videoElement.currentTime = seconds;
9944
+ _this.seekTo = function(seconds, keepPlaying) {
9945
+ if (_this.props.videoElement) {
9946
+ _this.props.videoElement.currentTime = seconds;
9800
9947
  if (!keepPlaying) {
9801
- _this1.pause();
9948
+ _this.pause();
9802
9949
  }
9803
9950
  }
9804
9951
  };
9805
- _this1.setVolume = function(volume) {
9806
- if (_this1.props.videoElement) {
9807
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
9952
+ _this.setVolume = function(volume) {
9953
+ if (_this.props.videoElement) {
9954
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
9808
9955
  }
9809
9956
  };
9810
- _this1.mute = function() {
9811
- if (_this1.props.videoElement) {
9812
- _this1.props.videoElement.muted = true;
9957
+ _this.mute = function() {
9958
+ if (_this.props.videoElement) {
9959
+ _this.props.videoElement.muted = true;
9813
9960
  }
9814
9961
  };
9815
- _this1.unmute = function() {
9816
- if (_this1.props.videoElement) {
9817
- _this1.props.videoElement.muted = false;
9962
+ _this.unmute = function() {
9963
+ if (_this.props.videoElement) {
9964
+ _this.props.videoElement.muted = false;
9818
9965
  }
9819
9966
  };
9820
- _this1.setPlaybackRate = function(rate) {
9821
- if (_this1.props.videoElement && rate > 0) {
9822
- _this1.props.videoElement.playbackRate = rate;
9967
+ _this.setPlaybackRate = function(rate) {
9968
+ if (_this.props.videoElement && rate > 0) {
9969
+ _this.props.videoElement.playbackRate = rate;
9823
9970
  }
9824
9971
  };
9825
- _this1.setLoop = function(loop) {
9826
- if (_this1.props.videoElement) {
9827
- _this1.props.videoElement.loop = loop;
9972
+ _this.setLoop = function(loop) {
9973
+ if (_this.props.videoElement) {
9974
+ _this.props.videoElement.loop = loop;
9828
9975
  }
9829
9976
  };
9830
- _this1.getDuration = function() {
9831
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
9832
- return _this1.props.videoElement.duration;
9977
+ _this.getDuration = function() {
9978
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
9979
+ return _this.props.videoElement.duration;
9833
9980
  }
9834
9981
  return null;
9835
9982
  };
9836
- _this1.getCurrentTime = function() {
9837
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
9838
- return _this1.props.videoElement.currentTime;
9983
+ _this.getCurrentTime = function() {
9984
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
9985
+ return _this.props.videoElement.currentTime;
9839
9986
  }
9840
9987
  return null;
9841
9988
  };
9842
- _this1.getSecondsLoaded = function() {
9843
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
9844
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
9989
+ _this.getSecondsLoaded = function() {
9990
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
9991
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
9845
9992
  }
9846
9993
  return null;
9847
9994
  };
9848
- _this1.getInternalPlayer = function() {
9995
+ _this.getInternalPlayer = function() {
9849
9996
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
9850
- if (key === "video") return _this1.props.videoElement;
9997
+ if (key === "video") return _this.props.videoElement;
9851
9998
  return null;
9852
9999
  };
9853
- _this1.enablePIP = function() {
10000
+ _this.enablePIP = function() {
9854
10001
  return _async_to_generator(function() {
9855
10002
  var error;
9856
10003
  return _ts_generator(this, function(_state) {
@@ -9893,7 +10040,7 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
9893
10040
  });
9894
10041
  })();
9895
10042
  };
9896
- _this1.disablePIP = function() {
10043
+ _this.disablePIP = function() {
9897
10044
  return _async_to_generator(function() {
9898
10045
  var error;
9899
10046
  return _ts_generator(this, function(_state) {
@@ -9987,7 +10134,7 @@ var players = [
9987
10134
  key: "file",
9988
10135
  name: "File Player",
9989
10136
  canPlay: canPlay.file,
9990
- canEnablePIP: function(url) {
10137
+ canEnablePIP: function canEnablePIP(url) {
9991
10138
  return canPlay.file(url) && (document.pictureInPictureEnabled || typeof document.webkitSupportsPresentationMode === "function");
9992
10139
  },
9993
10140
  lazyPlayer: lazy(function() {
@@ -10314,7 +10461,7 @@ var SUPPORTED_PROPS = [
10314
10461
  "onControlClick"
10315
10462
  ];
10316
10463
  var customPlayers = [];
10317
- var createStormcloudPlayer = function(playerList, fallback) {
10464
+ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallback) {
10318
10465
  var _a;
10319
10466
  return _a = /*#__PURE__*/ function(Component4) {
10320
10467
  "use strict";
@@ -10327,10 +10474,10 @@ var createStormcloudPlayer = function(playerList, fallback) {
10327
10474
  showPreview: false
10328
10475
  };
10329
10476
  _this.references = {
10330
- wrapper: function(wrapper) {
10477
+ wrapper: function wrapper(wrapper) {
10331
10478
  _this.wrapper = wrapper;
10332
10479
  },
10333
- player: function(player) {
10480
+ player: function player(player) {
10334
10481
  _this.player = player;
10335
10482
  }
10336
10483
  };