stormcloud-video-player 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/stormcloud-vp.min.js +1 -1
  2. package/lib/index.cjs +370 -447
  3. package/lib/index.cjs.map +1 -1
  4. package/lib/index.d.cts +355 -267
  5. package/lib/index.d.ts +355 -267
  6. package/lib/index.js +329 -406
  7. package/lib/index.js.map +1 -1
  8. package/lib/player/StormcloudVideoPlayer.cjs +96 -178
  9. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  10. package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
  11. package/lib/players/FilePlayer.cjs +99 -116
  12. package/lib/players/FilePlayer.cjs.map +1 -1
  13. package/lib/players/HlsPlayer.cjs +148 -230
  14. package/lib/players/HlsPlayer.cjs.map +1 -1
  15. package/lib/players/HlsPlayer.d.cts +1 -1
  16. package/lib/players/index.cjs +227 -309
  17. package/lib/players/index.cjs.map +1 -1
  18. package/lib/sdk/hlsAdPlayer.cjs +17 -9
  19. package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
  20. package/lib/sdk/hlsAdPlayer.d.cts +1 -1
  21. package/lib/sdk/ima.cjs +28 -20
  22. package/lib/sdk/ima.cjs.map +1 -1
  23. package/lib/sdk/ima.d.cts +1 -1
  24. package/lib/sdk/prebid.cjs +27 -85
  25. package/lib/sdk/prebid.cjs.map +1 -1
  26. package/lib/sdk/prebid.d.cts +6 -3
  27. package/lib/sdk/prebidController.cjs +35 -108
  28. package/lib/sdk/prebidController.cjs.map +1 -1
  29. package/lib/sdk/prebidController.d.cts +3 -2
  30. package/lib/sdk/vastParser.cjs +19 -11
  31. package/lib/sdk/vastParser.cjs.map +1 -1
  32. package/lib/{types-g2d4Akez.d.cts → types-CRi_KrjM.d.cts} +1 -45
  33. package/lib/ui/StormcloudVideoPlayer.cjs +190 -267
  34. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  35. package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
  36. package/lib/utils/browserCompat.cjs +11 -11
  37. package/lib/utils/browserCompat.cjs.map +1 -1
  38. package/lib/utils/polyfills.cjs +13 -13
  39. package/lib/utils/polyfills.cjs.map +1 -1
  40. package/lib/utils/tracking.cjs +19 -11
  41. package/lib/utils/tracking.cjs.map +1 -1
  42. package/lib/utils/tracking.d.cts +1 -1
  43. package/package.json +1 -1
@@ -227,9 +227,17 @@ function _ts_generator(thisArg, body) {
227
227
  },
228
228
  trys: [],
229
229
  ops: []
230
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
231
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
232
- return this;
230
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
231
+ return d(g, "next", {
232
+ value: verb(0)
233
+ }), d(g, "throw", {
234
+ value: verb(1)
235
+ }), d(g, "return", {
236
+ value: verb(2)
237
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
238
+ value: function() {
239
+ return this;
240
+ }
233
241
  }), g;
234
242
  function verb(n) {
235
243
  return function(v) {
@@ -329,20 +337,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
329
337
  var __getOwnPropNames = Object.getOwnPropertyNames;
330
338
  var __getProtoOf = Object.getPrototypeOf;
331
339
  var __hasOwnProp = Object.prototype.hasOwnProperty;
332
- var __export = function(target, all) {
340
+ var __export = function __export(target, all) {
333
341
  for(var name in all)__defProp(target, name, {
334
342
  get: all[name],
335
343
  enumerable: true
336
344
  });
337
345
  };
338
- var __copyProps = function(to, from, except, desc) {
346
+ var __copyProps = function __copyProps(to, from, except, desc) {
339
347
  if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
340
348
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
341
349
  try {
342
350
  var _loop = function() {
343
351
  var key = _step.value;
344
352
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
345
- get: function() {
353
+ get: function get() {
346
354
  return from[key];
347
355
  },
348
356
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -366,7 +374,7 @@ var __copyProps = function(to, from, except, desc) {
366
374
  }
367
375
  return to;
368
376
  };
369
- var __toESM = function(mod, isNodeMode, target) {
377
+ var __toESM = function __toESM(mod, isNodeMode, target) {
370
378
  return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
371
379
  // file that has been converted to a CommonJS file using a Babel-
372
380
  // compatible transform (i.e. "__esModule" has not been set), then set
@@ -376,7 +384,7 @@ var __toESM = function(mod, isNodeMode, target) {
376
384
  enumerable: true
377
385
  }) : target, mod);
378
386
  };
379
- var __toCommonJS = function(mod) {
387
+ var __toCommonJS = function __toCommonJS(mod) {
380
388
  return __copyProps(__defProp({}, "__esModule", {
381
389
  value: true
382
390
  }), mod);
@@ -384,7 +392,7 @@ var __toCommonJS = function(mod) {
384
392
  // src/players/index.ts
385
393
  var players_exports = {};
386
394
  __export(players_exports, {
387
- default: function() {
395
+ default: function _default() {
388
396
  return players_default;
389
397
  }
390
398
  });
@@ -403,23 +411,23 @@ var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
403
411
  var VIDEO_EXTENSIONS = /\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\?)/i;
404
412
  var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\?)/i;
405
413
  var canPlay = {
406
- hls: function(url) {
414
+ hls: function hls(url) {
407
415
  if (!url || typeof url !== "string") return false;
408
416
  return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);
409
417
  },
410
- dash: function(url) {
418
+ dash: function dash(url) {
411
419
  if (!url || typeof url !== "string") return false;
412
420
  return DASH_EXTENSIONS.test(url);
413
421
  },
414
- video: function(url) {
422
+ video: function video(url) {
415
423
  if (!url || typeof url !== "string") return false;
416
424
  return VIDEO_EXTENSIONS.test(url);
417
425
  },
418
- audio: function(url) {
426
+ audio: function audio(url) {
419
427
  if (!url || typeof url !== "string") return false;
420
428
  return AUDIO_EXTENSIONS.test(url);
421
429
  },
422
- file: function(url) {
430
+ file: function file(url) {
423
431
  if (!url || typeof url !== "string") return false;
424
432
  return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);
425
433
  }
@@ -755,7 +763,7 @@ function createImaController(video, options) {
755
763
  var fn = _step.value;
756
764
  try {
757
765
  fn(payload);
758
- } catch (e) {}
766
+ } catch (unused) {}
759
767
  }
760
768
  } catch (err) {
761
769
  _didIteratorError = true;
@@ -793,7 +801,7 @@ function createImaController(video, options) {
793
801
  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'.");
794
802
  }
795
803
  }
796
- } catch (e) {}
804
+ } catch (unused) {}
797
805
  if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
798
806
  var existing = document.querySelector('script[data-ima="true"]');
799
807
  if (existing) {
@@ -1041,7 +1049,7 @@ function createImaController(video, options) {
1041
1049
  if (adsManager) {
1042
1050
  try {
1043
1051
  adsManager.destroy();
1044
- } catch (e) {}
1052
+ } catch (unused) {}
1045
1053
  adsManager = void 0;
1046
1054
  }
1047
1055
  if (adVideoElement) {
@@ -1052,7 +1060,7 @@ function createImaController(video, options) {
1052
1060
  if (adsLoader) {
1053
1061
  try {
1054
1062
  adsLoader.destroy();
1055
- } catch (e) {}
1063
+ } catch (unused) {}
1056
1064
  adsLoader = void 0;
1057
1065
  }
1058
1066
  }
@@ -1070,7 +1078,7 @@ function createImaController(video, options) {
1070
1078
  try {
1071
1079
  var _adDisplayContainer_initialize;
1072
1080
  (_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
1073
- } catch (e) {}
1081
+ } catch (unused) {}
1074
1082
  }
1075
1083
  }).catch(function() {});
1076
1084
  },
@@ -1229,7 +1237,7 @@ function createImaController(video, options) {
1229
1237
  window.setTimeout(function() {
1230
1238
  try {
1231
1239
  makeAdsRequest(google, lastAdTagUrl);
1232
- } catch (e) {}
1240
+ } catch (unused) {}
1233
1241
  }, delay);
1234
1242
  } else {
1235
1243
  emit("ad_error", {
@@ -1261,7 +1269,7 @@ function createImaController(video, options) {
1261
1269
  if (adsManager) {
1262
1270
  try {
1263
1271
  adsManager.setVolume(adVolume);
1264
- } catch (e) {}
1272
+ } catch (unused) {}
1265
1273
  }
1266
1274
  emit("content_pause");
1267
1275
  });
@@ -1275,7 +1283,7 @@ function createImaController(video, options) {
1275
1283
  if (adsManager) {
1276
1284
  try {
1277
1285
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1278
- } catch (e) {}
1286
+ } catch (unused) {}
1279
1287
  }
1280
1288
  }
1281
1289
  if (adContainerEl) {
@@ -1436,7 +1444,7 @@ function createImaController(video, options) {
1436
1444
  }
1437
1445
  try {
1438
1446
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1439
- } catch (e) {}
1447
+ } catch (unused) {}
1440
1448
  adsManager.start();
1441
1449
  return [
1442
1450
  2,
@@ -1518,7 +1526,7 @@ function createImaController(video, options) {
1518
1526
  try {
1519
1527
  ;
1520
1528
  adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
1521
- } catch (e) {}
1529
+ } catch (unused) {}
1522
1530
  destroyAdsManager();
1523
1531
  return [
1524
1532
  2
@@ -1549,7 +1557,7 @@ function createImaController(video, options) {
1549
1557
  try {
1550
1558
  var _adsLoader_destroy;
1551
1559
  adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
1552
- } catch (e) {}
1560
+ } catch (unused) {}
1553
1561
  adDisplayContainer = void 0;
1554
1562
  adsLoader = void 0;
1555
1563
  contentVideoHidden = false;
@@ -1598,7 +1606,7 @@ function createImaController(video, options) {
1598
1606
  if (adsManager && adPlaying) {
1599
1607
  try {
1600
1608
  adsManager.setVolume(clampedVolume);
1601
- } catch (e) {}
1609
+ } catch (unused) {}
1602
1610
  }
1603
1611
  },
1604
1612
  getAdVolume: function getAdVolume() {
@@ -2511,12 +2519,12 @@ function createHlsAdPlayer(contentVideo, options) {
2511
2519
  }
2512
2520
  // src/sdk/prebid.ts
2513
2521
  var DEFAULT_TIMEOUT_MS = 3e3;
2514
- var AUCTION_PATH = "/openrtb2/auction";
2515
- function createPrebidManager(config) {
2522
+ var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
2523
+ function createPrebidManager() {
2524
+ var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2525
+ var _options_debug;
2516
2526
  var initialized = false;
2517
- var serverUrl = "";
2518
- var _config_debug;
2519
- var debug = (_config_debug = config.debug) !== null && _config_debug !== void 0 ? _config_debug : false;
2527
+ var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
2520
2528
  function log() {
2521
2529
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2522
2530
  args[_key] = arguments[_key];
@@ -2537,49 +2545,6 @@ function createPrebidManager(config) {
2537
2545
  "[Prebid]"
2538
2546
  ].concat(_to_consumable_array(args)));
2539
2547
  }
2540
- function resolveServerUrl() {
2541
- var _config_ortbRequest_ext_prebid_server, _config_ortbRequest_ext_prebid, _config_ortbRequest_ext, _config_ortbRequest;
2542
- if (config.serverUrl) {
2543
- return config.serverUrl.replace(/\/$/, "");
2544
- }
2545
- var extUrl = (_config_ortbRequest = config.ortbRequest) === null || _config_ortbRequest === void 0 ? void 0 : (_config_ortbRequest_ext = _config_ortbRequest.ext) === null || _config_ortbRequest_ext === void 0 ? void 0 : (_config_ortbRequest_ext_prebid = _config_ortbRequest_ext.prebid) === null || _config_ortbRequest_ext_prebid === void 0 ? void 0 : (_config_ortbRequest_ext_prebid_server = _config_ortbRequest_ext_prebid.server) === null || _config_ortbRequest_ext_prebid_server === void 0 ? void 0 : _config_ortbRequest_ext_prebid_server.externalurl;
2546
- if (typeof extUrl === "string" && extUrl.length > 0) {
2547
- return extUrl.replace(/\/$/, "");
2548
- }
2549
- throw new Error("Prebid Server URL not configured. Provide serverUrl in PrebidConfig or ext.prebid.server.externalurl in the OpenRTB request.");
2550
- }
2551
- function buildRequest() {
2552
- var req = JSON.parse(JSON.stringify(config.ortbRequest));
2553
- req.id = "".concat(req.id || "prebid", "-").concat(Date.now(), "-").concat(Math.random().toString(36).slice(2, 8));
2554
- if (!req.ext) req.ext = {};
2555
- if (!req.ext.prebid) req.ext.prebid = {};
2556
- if (!req.ext.prebid.cache) req.ext.prebid.cache = {};
2557
- if (!req.ext.prebid.cache.vastxml) req.ext.prebid.cache.vastxml = {};
2558
- if (!req.ext.prebid.targeting) {
2559
- req.ext.prebid.targeting = {
2560
- includewinners: true,
2561
- includebidderkeys: false
2562
- };
2563
- }
2564
- if (!req.device) req.device = {};
2565
- if (typeof navigator !== "undefined") {
2566
- if (!req.device.ua) req.device.ua = navigator.userAgent;
2567
- if (!req.device.language) {
2568
- req.device.language = (navigator.language || "").split("-")[0] || "en";
2569
- }
2570
- }
2571
- if (typeof window !== "undefined") {
2572
- var _window_screen, _window_screen1;
2573
- if (!req.device.w) req.device.w = ((_window_screen = window.screen) === null || _window_screen === void 0 ? void 0 : _window_screen.width) || window.innerWidth;
2574
- if (!req.device.h) req.device.h = ((_window_screen1 = window.screen) === null || _window_screen1 === void 0 ? void 0 : _window_screen1.height) || window.innerHeight;
2575
- }
2576
- if (!req.site) req.site = {};
2577
- if (typeof window !== "undefined") {
2578
- if (!req.site.page) req.site.page = window.location.href;
2579
- if (!req.site.domain) req.site.domain = window.location.hostname;
2580
- }
2581
- return req;
2582
- }
2583
2548
  function parseResponse(data) {
2584
2549
  var bids = [];
2585
2550
  var seatbids = (data === null || data === void 0 ? void 0 : data.seatbid) || [];
@@ -2649,12 +2614,6 @@ function createPrebidManager(config) {
2649
2614
  function extractVastUrl(bids) {
2650
2615
  if (bids.length === 0) return null;
2651
2616
  var winner = bids[0];
2652
- var _config_cpmFloor;
2653
- var cpmFloor = (_config_cpmFloor = config.cpmFloor) !== null && _config_cpmFloor !== void 0 ? _config_cpmFloor : 0;
2654
- if (cpmFloor > 0 && winner.cpm < cpmFloor) {
2655
- log("Winning bid $".concat(winner.cpm.toFixed(2), " below CPM floor $").concat(cpmFloor.toFixed(2), ", rejecting"));
2656
- return null;
2657
- }
2658
2617
  if (winner.vastUrl) {
2659
2618
  log("Using cached VAST URL from ".concat(winner.bidder, " ($").concat(winner.cpm.toFixed(2), " ").concat(winner.currency, ")"));
2660
2619
  return winner.vastUrl;
@@ -2676,22 +2635,12 @@ function createPrebidManager(config) {
2676
2635
  }
2677
2636
  function initialize() {
2678
2637
  return _async_to_generator(function() {
2679
- var _config_ortbRequest;
2680
2638
  return _ts_generator(this, function(_state) {
2681
2639
  if (initialized) return [
2682
2640
  2
2683
2641
  ];
2684
- serverUrl = resolveServerUrl();
2685
- if (!((_config_ortbRequest = config.ortbRequest) === null || _config_ortbRequest === void 0 ? void 0 : _config_ortbRequest.imp) || config.ortbRequest.imp.length === 0) {
2686
- throw new Error("No impressions (imp) defined in the OpenRTB request.");
2687
- }
2688
2642
  initialized = true;
2689
- log("Initialized with server:", serverUrl);
2690
- log("Bidders:", config.ortbRequest.imp.map(function(imp) {
2691
- var _imp_ext_prebid, _imp_ext;
2692
- var bidders = (_imp_ext = imp.ext) === null || _imp_ext === void 0 ? void 0 : (_imp_ext_prebid = _imp_ext.prebid) === null || _imp_ext_prebid === void 0 ? void 0 : _imp_ext_prebid.bidder;
2693
- return bidders ? Object.keys(bidders).join(", ") : "none";
2694
- }).join("; "));
2643
+ log("Initialized, auction URL:", AUCTION_URL);
2695
2644
  return [
2696
2645
  2
2697
2646
  ];
@@ -2700,17 +2649,15 @@ function createPrebidManager(config) {
2700
2649
  }
2701
2650
  function requestBids() {
2702
2651
  return _async_to_generator(function() {
2703
- var auctionUrl, request, _config_timeout, _ref, timeout, controller, timeoutId, _data_ext, _data_ext1, fetchOptions, response, body, data, bids, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, b, error;
2652
+ var timeout, controller, timeoutId, _data_ext, _data_ext1, fetchOptions, response, body, data, bids, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, b, error;
2704
2653
  return _ts_generator(this, function(_state) {
2705
2654
  switch(_state.label){
2706
2655
  case 0:
2707
2656
  if (!initialized) {
2708
2657
  throw new Error("Prebid not initialized. Call initialize() first.");
2709
2658
  }
2710
- auctionUrl = "".concat(serverUrl).concat(AUCTION_PATH);
2711
- request = buildRequest();
2712
- timeout = (_ref = (_config_timeout = config.timeout) !== null && _config_timeout !== void 0 ? _config_timeout : config.ortbRequest.tmax) !== null && _ref !== void 0 ? _ref : DEFAULT_TIMEOUT_MS;
2713
- log("Sending auction request to:", auctionUrl);
2659
+ timeout = DEFAULT_TIMEOUT_MS;
2660
+ log("Fetching auction response from:", AUCTION_URL);
2714
2661
  controller = typeof AbortController !== "undefined" ? new AbortController() : null;
2715
2662
  timeoutId = setTimeout(function() {
2716
2663
  controller === null || controller === void 0 ? void 0 : controller.abort();
@@ -2724,18 +2671,14 @@ function createPrebidManager(config) {
2724
2671
  7
2725
2672
  ]);
2726
2673
  fetchOptions = {
2727
- method: "POST",
2728
- headers: {
2729
- "Content-Type": "application/json"
2730
- },
2731
- body: JSON.stringify(request)
2674
+ method: "POST"
2732
2675
  };
2733
2676
  if (controller) {
2734
2677
  fetchOptions.signal = controller.signal;
2735
2678
  }
2736
2679
  return [
2737
2680
  4,
2738
- fetch(auctionUrl, fetchOptions)
2681
+ fetch(AUCTION_URL, fetchOptions)
2739
2682
  ];
2740
2683
  case 2:
2741
2684
  response = _state.sent();
@@ -2852,7 +2795,6 @@ function createPrebidManager(config) {
2852
2795
  }
2853
2796
  function destroy() {
2854
2797
  initialized = false;
2855
- serverUrl = "";
2856
2798
  log("Destroyed");
2857
2799
  }
2858
2800
  return {
@@ -2868,7 +2810,7 @@ function createPrebidManager(config) {
2868
2810
  // src/sdk/prebidController.ts
2869
2811
  var import_hls2 = __toESM(require("hls.js"), 1);
2870
2812
  var LOG = "[PrebidController]";
2871
- function createPrebidController(contentVideo, prebidConfig, options) {
2813
+ function createPrebidController(contentVideo, options) {
2872
2814
  var adPlaying = false;
2873
2815
  var originalMutedState = false;
2874
2816
  var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
@@ -2882,11 +2824,9 @@ function createPrebidController(contentVideo, prebidConfig, options) {
2882
2824
  var sessionId;
2883
2825
  var destroyed = false;
2884
2826
  var trackingFired = createEmptyTrackingState();
2885
- var _prebidConfig_debug;
2886
- var prebidDebug = (_prebidConfig_debug = prebidConfig.debug) !== null && _prebidConfig_debug !== void 0 ? _prebidConfig_debug : false;
2887
- var prebidManager = createPrebidManager(_object_spread_props(_object_spread({}, prebidConfig), {
2888
- debug: prebidDebug
2889
- }));
2827
+ var prebidManager = createPrebidManager((options === null || options === void 0 ? void 0 : options.debug) !== void 0 ? {
2828
+ debug: options.debug
2829
+ } : {});
2890
2830
  var prebidInitialized = false;
2891
2831
  function emit(event, payload) {
2892
2832
  var set = listeners.get(event);
@@ -3085,6 +3025,8 @@ function createPrebidController(contentVideo, prebidConfig, options) {
3085
3025
  adContainerEl.style.display = "none";
3086
3026
  adContainerEl.style.pointerEvents = "none";
3087
3027
  }
3028
+ contentVideo.style.visibility = "visible";
3029
+ contentVideo.style.opacity = "1";
3088
3030
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
3089
3031
  if (contentVideo.paused) {
3090
3032
  console.log("".concat(LOG, " Content video paused in live mode, resuming playback"));
@@ -3109,19 +3051,12 @@ function createPrebidController(contentVideo, prebidConfig, options) {
3109
3051
  }
3110
3052
  function ensurePrebidInitialized() {
3111
3053
  return _async_to_generator(function() {
3112
- var _prebidConfig_ortbRequest_imp, _prebidConfig_ortbRequest;
3113
3054
  return _ts_generator(this, function(_state) {
3114
3055
  switch(_state.label){
3115
3056
  case 0:
3116
3057
  if (prebidInitialized) return [
3117
3058
  2
3118
3059
  ];
3119
- if (prebidConfig.enabled === false) {
3120
- throw new Error("Prebid is disabled in config");
3121
- }
3122
- if (!((_prebidConfig_ortbRequest = prebidConfig.ortbRequest) === null || _prebidConfig_ortbRequest === void 0 ? void 0 : (_prebidConfig_ortbRequest_imp = _prebidConfig_ortbRequest.imp) === null || _prebidConfig_ortbRequest_imp === void 0 ? void 0 : _prebidConfig_ortbRequest_imp.length)) {
3123
- throw new Error("No impressions configured in ortbRequest");
3124
- }
3125
3060
  return [
3126
3061
  4,
3127
3062
  prebidManager.initialize()
@@ -3139,7 +3074,7 @@ function createPrebidController(contentVideo, prebidConfig, options) {
3139
3074
  }
3140
3075
  function runPrebidAuction() {
3141
3076
  return _async_to_generator(function() {
3142
- var bids, _prebidConfig_cpmFloor, cpmFloor, winner;
3077
+ var bids, winner;
3143
3078
  return _ts_generator(this, function(_state) {
3144
3079
  switch(_state.label){
3145
3080
  case 0:
@@ -3162,15 +3097,7 @@ function createPrebidController(contentVideo, prebidConfig, options) {
3162
3097
  null
3163
3098
  ];
3164
3099
  }
3165
- cpmFloor = (_prebidConfig_cpmFloor = prebidConfig.cpmFloor) !== null && _prebidConfig_cpmFloor !== void 0 ? _prebidConfig_cpmFloor : 0;
3166
3100
  winner = bids[0];
3167
- if (cpmFloor > 0 && winner.cpm < cpmFloor) {
3168
- console.log("".concat(LOG, " Winning bid $").concat(winner.cpm.toFixed(2), " below CPM floor $").concat(cpmFloor.toFixed(2), ", rejecting"));
3169
- return [
3170
- 2,
3171
- null
3172
- ];
3173
- }
3174
3101
  console.log("".concat(LOG, " Winning bid: ").concat(winner.bidder, " $").concat(winner.cpm.toFixed(2), " ").concat(winner.currency));
3175
3102
  if (winner.vastXml) {
3176
3103
  console.log("".concat(LOG, " Parsing VAST XML from bid response (inline)"));
@@ -4275,22 +4202,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4275
4202
  adPlayerType = "hls";
4276
4203
  }
4277
4204
  if (adPlayerType === "prebid") {
4278
- if (!this.config.prebid) {
4279
- console.warn("[StormcloudVideoPlayer] adPlayerType is 'prebid' but no prebid config provided, falling back to HLS ad player");
4280
- return createHlsAdPlayer(this.video, _object_spread({
4281
- continueLiveStreamDuringAds: continueLiveStreamDuringAds
4282
- }, this.config.licenseKey ? {
4283
- licenseKey: this.config.licenseKey
4284
- } : {}, this.hls ? {
4285
- mainHlsInstance: this.hls
4286
- } : {}));
4287
- }
4288
4205
  if (this.config.debugAdTiming) {
4289
4206
  console.log("[StormcloudVideoPlayer] Creating Prebid ad controller (standalone, no IMA SDK)");
4290
4207
  }
4291
- return createPrebidController(this.video, this.config.prebid, _object_spread({
4208
+ return createPrebidController(this.video, _object_spread({
4292
4209
  continueLiveStreamDuringAds: continueLiveStreamDuringAds
4293
- }, this.config.licenseKey ? {
4210
+ }, this.config.debugAdTiming !== void 0 ? {
4211
+ debug: this.config.debugAdTiming
4212
+ } : {}, this.config.licenseKey ? {
4294
4213
  licenseKey: this.config.licenseKey
4295
4214
  } : {}, this.hls ? {
4296
4215
  mainHlsInstance: this.hls
@@ -4416,7 +4335,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4416
4335
  });
4417
4336
  this.hls.on(import_hls3.default.Events.MANIFEST_PARSED, function(_, data) {
4418
4337
  return _async_to_generator(function() {
4419
- var _this_hls_levels, _this_hls, _this_hls_levels_some, adBehavior, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
4338
+ var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
4420
4339
  return _ts_generator(this, function(_state) {
4421
4340
  switch(_state.label){
4422
4341
  case 0:
@@ -4425,10 +4344,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4425
4344
  } else {
4426
4345
  ;
4427
4346
  ;
4428
- 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) {
4347
+ 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) {
4429
4348
  var _level_details, _level_details1;
4430
4349
  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";
4431
- })) !== null && _this_hls_levels_some !== void 0 ? _this_hls_levels_some : false;
4350
+ })) !== null && _ref !== void 0 ? _ref : false;
4432
4351
  }
4433
4352
  if (this.config.debugAdTiming) {
4434
4353
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -4492,9 +4411,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4492
4411
  var tag = "";
4493
4412
  var value = "";
4494
4413
  if (Array.isArray(entry)) {
4495
- var _entry_;
4414
+ var _entry_, _entry_1;
4496
4415
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4497
- var _entry_1;
4498
4416
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4499
4417
  } else if (typeof entry === "string") {
4500
4418
  var idx = entry.indexOf(":");
@@ -4617,9 +4535,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4617
4535
  var tag = "";
4618
4536
  var value = "";
4619
4537
  if (Array.isArray(entry)) {
4620
- var _entry_;
4538
+ var _entry_, _entry_1;
4621
4539
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4622
- var _entry_1;
4623
4540
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4624
4541
  } else if (typeof entry === "string") {
4625
4542
  var idx = entry.indexOf(":");
@@ -4669,10 +4586,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4669
4586
  }
4670
4587
  });
4671
4588
  } else if (tag.includes("EXT-X-DATERANGE")) {
4589
+ var _attrs_CLASS;
4672
4590
  var attrs = _this.parseAttributeList(value);
4673
4591
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4674
4592
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4675
- var _attrs_CLASS;
4676
4593
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4677
4594
  var duration = _this.toNumber(attrs["DURATION"]);
4678
4595
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -5074,11 +4991,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5074
4991
  }
5075
4992
  var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
5076
4993
  if (daterangeMatch) {
5077
- var _daterangeMatch_;
4994
+ var _daterangeMatch_, _attrs_CLASS;
5078
4995
  var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
5079
4996
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
5080
4997
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
5081
- var _attrs_CLASS;
5082
4998
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
5083
4999
  var duration = this.toNumber(attrs["DURATION"]);
5084
5000
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -5154,7 +5070,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5154
5070
  var out = "";
5155
5071
  for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
5156
5072
  return out;
5157
- } catch (e) {
5073
+ } catch (unused) {
5158
5074
  return void 0;
5159
5075
  }
5160
5076
  }
@@ -5173,6 +5089,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5173
5089
  });
5174
5090
  }
5175
5091
  if (marker.type === "start") {
5092
+ var _this_config_immediateManifestAds;
5176
5093
  var _this_pendingAdBreak;
5177
5094
  if (!this.video.muted) {
5178
5095
  this.video.muted = true;
@@ -5197,7 +5114,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5197
5114
  this.expectedAdBreakDurationMs = durationMs;
5198
5115
  this.currentAdBreakStartWallClockMs = Date.now();
5199
5116
  var isManifestMarker = this.isManifestBasedMarker(marker);
5200
- var _this_config_immediateManifestAds;
5201
5117
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
5202
5118
  if (this.config.debugAdTiming) {
5203
5119
  console.log("[StormcloudVideoPlayer] Ad start decision:", {
@@ -5352,9 +5268,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5352
5268
  var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
5353
5269
  var match;
5354
5270
  while((match = regex.exec(value)) !== null){
5355
- var _match_;
5271
+ var _match_, _ref, _match_1;
5356
5272
  var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
5357
- var _match_1, _ref;
5358
5273
  var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
5359
5274
  if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
5360
5275
  rawVal = rawVal.slice(1, -1);
@@ -5713,13 +5628,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5713
5628
  {
5714
5629
  key: "shouldShowNativeControls",
5715
5630
  value: function shouldShowNativeControls() {
5631
+ var _this_config_showCustomControls;
5716
5632
  var streamType = this.getStreamType();
5717
5633
  if (streamType === "other") {
5718
- var _this_config_showCustomControls;
5719
- return !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false);
5634
+ var _this_config_showCustomControls1;
5635
+ return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
5720
5636
  }
5721
- var _this_config_showCustomControls1;
5722
- return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
5637
+ return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
5723
5638
  }
5724
5639
  },
5725
5640
  {
@@ -5878,12 +5793,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5878
5793
  continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
5879
5794
  preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
5880
5795
  preloadIma.initialize();
5881
- errorListener = function(payload) {
5796
+ errorListener = function errorListener(payload) {
5882
5797
  hasAdError = true;
5883
5798
  adErrorPayload = payload;
5884
5799
  };
5885
5800
  preloadIma.on("ad_error", errorListener);
5886
- errorListenerCleanup = function() {
5801
+ errorListenerCleanup = function errorListenerCleanup() {
5887
5802
  return preloadIma.off("ad_error", errorListener);
5888
5803
  };
5889
5804
  return [
@@ -5934,7 +5849,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5934
5849
  isReady: true,
5935
5850
  loadPromise: Promise.resolve()
5936
5851
  };
5937
- lateErrorListener = function(payload) {
5852
+ lateErrorListener = function lateErrorListener(payload) {
5938
5853
  var index = _this.preloadPool.findIndex(function(entry) {
5939
5854
  return entry.vastUrl === vastUrl;
5940
5855
  });
@@ -5945,7 +5860,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5945
5860
  }
5946
5861
  try {
5947
5862
  preloadIma.destroy();
5948
- } catch (e) {}
5863
+ } catch (unused) {}
5949
5864
  }
5950
5865
  };
5951
5866
  preloadIma.on("ad_error", lateErrorListener);
@@ -6770,7 +6685,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6770
6685
  10
6771
6686
  ];
6772
6687
  nextAdUrl = this.adRequestQueue.shift();
6773
- if (!nextAdUrl) {
6688
+ if (nextAdUrl == null) {
6774
6689
  return [
6775
6690
  3,
6776
6691
  4
@@ -6956,7 +6871,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6956
6871
  9
6957
6872
  ];
6958
6873
  nextAdUrl = this.adRequestQueue.shift();
6959
- if (!nextAdUrl) {
6874
+ if (nextAdUrl == null) {
6960
6875
  return [
6961
6876
  3,
6962
6877
  3
@@ -7161,11 +7076,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7161
7076
  {
7162
7077
  key: "ensureAdStoppedByTimer",
7163
7078
  value: function ensureAdStoppedByTimer() {
7079
+ var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
7164
7080
  if (!this.inAdBreak) return;
7165
7081
  this.adStopTimerId = void 0;
7166
7082
  var adPlaying = this.ima.isAdPlaying();
7167
7083
  var pendingAds = this.adPodQueue.length > 0;
7168
- var _this_config_adBreakCheckIntervalMs;
7169
7084
  var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
7170
7085
  var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
7171
7086
  var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
@@ -7173,7 +7088,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7173
7088
  if (this.currentAdBreakStartWallClockMs != null) {
7174
7089
  elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
7175
7090
  }
7176
- var _this_expectedAdBreakDurationMs;
7177
7091
  var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
7178
7092
  var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
7179
7093
  var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
@@ -7430,15 +7344,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7430
7344
  9
7431
7345
  ];
7432
7346
  case 9:
7433
- if (this.isTemporaryAdError(playError)) {
7434
- this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7435
- if (this.config.debugAdTiming) {
7436
- console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
7437
- }
7438
- } else {
7439
- this.failedVastUrls.add(vastTagUrl);
7440
- if (this.config.debugAdTiming) {
7441
- console.log("[AD-ERROR] Permanent play error - URL blacklisted");
7347
+ if (vastTagUrl) {
7348
+ if (this.isTemporaryAdError(playError)) {
7349
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7350
+ if (this.config.debugAdTiming) {
7351
+ console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
7352
+ }
7353
+ } else {
7354
+ this.failedVastUrls.add(vastTagUrl);
7355
+ if (this.config.debugAdTiming) {
7356
+ console.log("[AD-ERROR] Permanent play error - URL blacklisted");
7357
+ }
7442
7358
  }
7443
7359
  }
7444
7360
  this.clearAdFailsafeTimer();
@@ -7507,15 +7423,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7507
7423
  15
7508
7424
  ];
7509
7425
  case 15:
7510
- if (this.isTemporaryAdError(error)) {
7511
- this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7512
- if (this.config.debugAdTiming) {
7513
- console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
7514
- }
7515
- } else {
7516
- this.failedVastUrls.add(vastTagUrl);
7517
- if (this.config.debugAdTiming) {
7518
- console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
7426
+ if (vastTagUrl) {
7427
+ if (this.isTemporaryAdError(error)) {
7428
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7429
+ if (this.config.debugAdTiming) {
7430
+ console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
7431
+ }
7432
+ } else {
7433
+ this.failedVastUrls.add(vastTagUrl);
7434
+ if (this.config.debugAdTiming) {
7435
+ console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
7436
+ }
7519
7437
  }
7520
7438
  }
7521
7439
  this.clearAdRequestWatchdog();
@@ -7618,8 +7536,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7618
7536
  key: "startAdRequestWatchdog",
7619
7537
  value: function startAdRequestWatchdog(token) {
7620
7538
  var _this = this;
7621
- this.clearAdRequestWatchdog();
7622
7539
  var _this_config_adFailsafeTimeoutMs;
7540
+ this.clearAdRequestWatchdog();
7623
7541
  var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7624
7542
  this.adRequestWatchdogToken = token;
7625
7543
  this.adRequestWatchdogId = window.setTimeout(function() {
@@ -7662,8 +7580,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7662
7580
  key: "startAdFailsafeTimer",
7663
7581
  value: function startAdFailsafeTimer(token) {
7664
7582
  var _this = this;
7665
- this.clearAdFailsafeTimer();
7666
7583
  var _this_config_adFailsafeTimeoutMs;
7584
+ this.clearAdFailsafeTimer();
7667
7585
  var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7668
7586
  this.adFailsafeToken = token;
7669
7587
  this.adFailsafeTimerId = window.setTimeout(function() {
@@ -7983,11 +7901,11 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react2_Component) {
7983
7901
  function HlsPlayer() {
7984
7902
  _class_call_check(this, HlsPlayer);
7985
7903
  var _this;
7986
- var _this1, _arguments = arguments;
7987
- _this = _call_super(this, HlsPlayer, _to_consumable_array(_arguments)), _this1 = _this;
7988
- _this1.player = null;
7989
- _this1.mounted = false;
7990
- _this1.load = function() {
7904
+ var _this1;
7905
+ _this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
7906
+ _this.player = null;
7907
+ _this.mounted = false;
7908
+ _this.load = function() {
7991
7909
  return _async_to_generator(function() {
7992
7910
  var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
7993
7911
  return _ts_generator(this, function(_state) {
@@ -8060,87 +7978,87 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react2_Component) {
8060
7978
  });
8061
7979
  })();
8062
7980
  };
8063
- _this1.play = function() {
8064
- if (_this1.props.videoElement) {
8065
- var video = _this1.props.videoElement;
7981
+ _this.play = function() {
7982
+ if (_this.props.videoElement) {
7983
+ var video = _this.props.videoElement;
8066
7984
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
8067
7985
  if (hasValidSource) {
8068
7986
  var _video_play, _this_props_onPlay, _this_props;
8069
7987
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
8070
7988
  var _this_props_onError, _this_props;
8071
7989
  console.error("[HlsPlayer] Failed to play:", error);
8072
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
7990
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8073
7991
  });
8074
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
7992
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8075
7993
  } else {
8076
7994
  console.warn("[HlsPlayer] Cannot play: video has no valid source");
8077
7995
  }
8078
7996
  }
8079
7997
  };
8080
- _this1.pause = function() {
8081
- if (_this1.props.videoElement) {
7998
+ _this.pause = function() {
7999
+ if (_this.props.videoElement) {
8082
8000
  var _this_props_onPause, _this_props;
8083
- _this1.props.videoElement.pause();
8084
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8001
+ _this.props.videoElement.pause();
8002
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8085
8003
  }
8086
8004
  };
8087
- _this1.stop = function() {
8088
- _this1.pause();
8089
- if (_this1.props.videoElement) {
8090
- _this1.props.videoElement.currentTime = 0;
8005
+ _this.stop = function() {
8006
+ _this.pause();
8007
+ if (_this.props.videoElement) {
8008
+ _this.props.videoElement.currentTime = 0;
8091
8009
  }
8092
8010
  };
8093
- _this1.seekTo = function(seconds, keepPlaying) {
8094
- if (_this1.props.videoElement) {
8095
- _this1.props.videoElement.currentTime = seconds;
8011
+ _this.seekTo = function(seconds, keepPlaying) {
8012
+ if (_this.props.videoElement) {
8013
+ _this.props.videoElement.currentTime = seconds;
8096
8014
  if (!keepPlaying) {
8097
- _this1.pause();
8015
+ _this.pause();
8098
8016
  }
8099
8017
  }
8100
8018
  };
8101
- _this1.setVolume = function(volume) {
8102
- if (_this1.props.videoElement) {
8103
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8019
+ _this.setVolume = function(volume) {
8020
+ if (_this.props.videoElement) {
8021
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8104
8022
  }
8105
8023
  };
8106
- _this1.mute = function() {
8107
- if (_this1.props.videoElement) {
8108
- _this1.props.videoElement.muted = true;
8024
+ _this.mute = function() {
8025
+ if (_this.props.videoElement) {
8026
+ _this.props.videoElement.muted = true;
8109
8027
  }
8110
8028
  };
8111
- _this1.unmute = function() {
8112
- if (_this1.props.videoElement) {
8113
- _this1.props.videoElement.muted = false;
8029
+ _this.unmute = function() {
8030
+ if (_this.props.videoElement) {
8031
+ _this.props.videoElement.muted = false;
8114
8032
  }
8115
8033
  };
8116
- _this1.setPlaybackRate = function(rate) {
8117
- if (_this1.props.videoElement && rate > 0) {
8118
- _this1.props.videoElement.playbackRate = rate;
8034
+ _this.setPlaybackRate = function(rate) {
8035
+ if (_this.props.videoElement && rate > 0) {
8036
+ _this.props.videoElement.playbackRate = rate;
8119
8037
  }
8120
8038
  };
8121
- _this1.getDuration = function() {
8122
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
8123
- return _this1.props.videoElement.duration;
8039
+ _this.getDuration = function() {
8040
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
8041
+ return _this.props.videoElement.duration;
8124
8042
  }
8125
8043
  return null;
8126
8044
  };
8127
- _this1.getCurrentTime = function() {
8128
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
8129
- return _this1.props.videoElement.currentTime;
8045
+ _this.getCurrentTime = function() {
8046
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
8047
+ return _this.props.videoElement.currentTime;
8130
8048
  }
8131
8049
  return null;
8132
8050
  };
8133
- _this1.getSecondsLoaded = function() {
8134
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
8135
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
8051
+ _this.getSecondsLoaded = function() {
8052
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
8053
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
8136
8054
  }
8137
8055
  return null;
8138
8056
  };
8139
- _this1.getInternalPlayer = function() {
8057
+ _this.getInternalPlayer = function() {
8140
8058
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
8141
- if (key === "player") return _this1.player;
8142
- if (key === "video") return _this1.props.videoElement;
8143
- if (key === "hls" && _this1.player) return _this1.player.hls;
8059
+ if (key === "player") return _this.player;
8060
+ if (key === "video") return _this.props.videoElement;
8061
+ if (key === "hls" && _this.player) return _this.player.hls;
8144
8062
  return null;
8145
8063
  };
8146
8064
  return _this;
@@ -8189,49 +8107,49 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
8189
8107
  function FilePlayer() {
8190
8108
  _class_call_check(this, FilePlayer);
8191
8109
  var _this;
8192
- var _this1, _arguments = arguments;
8193
- _this = _call_super(this, FilePlayer, _to_consumable_array(_arguments)), _this1 = _this;
8194
- _this1.mounted = false;
8195
- _this1.ready = false;
8196
- _this1.load = function() {
8110
+ var _this1;
8111
+ _this = _call_super(this, FilePlayer, arguments), _this1 = _this;
8112
+ _this.mounted = false;
8113
+ _this.ready = false;
8114
+ _this.load = function() {
8197
8115
  var _this_props_onMount, _this_props;
8198
- if (!_this1.props.videoElement || !_this1.props.src) return;
8199
- var video = _this1.props.videoElement;
8200
- var handleLoadedMetadata = function() {
8201
- if (_this1.mounted && !_this1.ready) {
8116
+ if (!_this.props.videoElement || !_this.props.src) return;
8117
+ var video = _this.props.videoElement;
8118
+ var handleLoadedMetadata = function handleLoadedMetadata() {
8119
+ if (_this.mounted && !_this.ready) {
8202
8120
  var _this_props_onReady, _this_props;
8203
- _this1.ready = true;
8204
- (_this_props_onReady = (_this_props = _this1.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
8121
+ _this.ready = true;
8122
+ (_this_props_onReady = (_this_props = _this.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
8205
8123
  }
8206
8124
  };
8207
- var handlePlay = function() {
8208
- if (_this1.mounted) {
8125
+ var handlePlay = function handlePlay() {
8126
+ if (_this.mounted) {
8209
8127
  var _this_props_onPlay, _this_props;
8210
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8128
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8211
8129
  }
8212
8130
  };
8213
- var handlePause = function() {
8214
- if (_this1.mounted) {
8131
+ var handlePause = function handlePause() {
8132
+ if (_this.mounted) {
8215
8133
  var _this_props_onPause, _this_props;
8216
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8134
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8217
8135
  }
8218
8136
  };
8219
- var handleEnded = function() {
8220
- if (_this1.mounted) {
8137
+ var handleEnded = function handleEnded() {
8138
+ if (_this.mounted) {
8221
8139
  var _this_props_onEnded, _this_props;
8222
- (_this_props_onEnded = (_this_props = _this1.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
8140
+ (_this_props_onEnded = (_this_props = _this.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
8223
8141
  }
8224
8142
  };
8225
- var handleError = function(error) {
8226
- if (_this1.mounted) {
8143
+ var handleError = function handleError(error) {
8144
+ if (_this.mounted) {
8227
8145
  var _this_props_onError, _this_props;
8228
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8146
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8229
8147
  }
8230
8148
  };
8231
- var handleLoadedData = function() {
8232
- if (_this1.mounted) {
8149
+ var handleLoadedData = function handleLoadedData() {
8150
+ if (_this.mounted) {
8233
8151
  var _this_props_onLoaded, _this_props;
8234
- (_this_props_onLoaded = (_this_props = _this1.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
8152
+ (_this_props_onLoaded = (_this_props = _this.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
8235
8153
  }
8236
8154
  };
8237
8155
  video.addEventListener("loadedmetadata", handleLoadedMetadata);
@@ -8240,15 +8158,15 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
8240
8158
  video.addEventListener("ended", handleEnded);
8241
8159
  video.addEventListener("error", handleError);
8242
8160
  video.addEventListener("loadeddata", handleLoadedData);
8243
- video.src = _this1.props.src;
8244
- if (_this1.props.autoplay !== void 0) video.autoplay = _this1.props.autoplay;
8245
- if (_this1.props.muted !== void 0) video.muted = _this1.props.muted;
8246
- if (_this1.props.loop !== void 0) video.loop = _this1.props.loop;
8247
- if (_this1.props.controls !== void 0) video.controls = _this1.props.controls;
8248
- if (_this1.props.playsInline !== void 0) video.playsInline = _this1.props.playsInline;
8249
- if (_this1.props.preload !== void 0) video.preload = _this1.props.preload;
8250
- if (_this1.props.poster !== void 0) video.poster = _this1.props.poster;
8251
- (_this_props_onMount = (_this_props = _this1.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this1);
8161
+ video.src = _this.props.src;
8162
+ if (_this.props.autoplay !== void 0) video.autoplay = _this.props.autoplay;
8163
+ if (_this.props.muted !== void 0) video.muted = _this.props.muted;
8164
+ if (_this.props.loop !== void 0) video.loop = _this.props.loop;
8165
+ if (_this.props.controls !== void 0) video.controls = _this.props.controls;
8166
+ if (_this.props.playsInline !== void 0) video.playsInline = _this.props.playsInline;
8167
+ if (_this.props.preload !== void 0) video.preload = _this.props.preload;
8168
+ if (_this.props.poster !== void 0) video.poster = _this.props.poster;
8169
+ (_this_props_onMount = (_this_props = _this.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this);
8252
8170
  return function() {
8253
8171
  video.removeEventListener("loadedmetadata", handleLoadedMetadata);
8254
8172
  video.removeEventListener("play", handlePlay);
@@ -8258,90 +8176,90 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
8258
8176
  video.removeEventListener("loadeddata", handleLoadedData);
8259
8177
  };
8260
8178
  };
8261
- _this1.play = function() {
8262
- if (_this1.props.videoElement) {
8263
- var video = _this1.props.videoElement;
8179
+ _this.play = function() {
8180
+ if (_this.props.videoElement) {
8181
+ var video = _this.props.videoElement;
8264
8182
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
8265
8183
  if (hasValidSource) {
8266
8184
  var _video_play;
8267
8185
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
8268
8186
  var _this_props_onError, _this_props;
8269
8187
  console.error("[FilePlayer] Failed to play:", error);
8270
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8188
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8271
8189
  });
8272
8190
  } else {
8273
8191
  console.warn("[FilePlayer] Cannot play: video has no valid source");
8274
8192
  }
8275
8193
  }
8276
8194
  };
8277
- _this1.pause = function() {
8278
- if (_this1.props.videoElement) {
8279
- _this1.props.videoElement.pause();
8195
+ _this.pause = function() {
8196
+ if (_this.props.videoElement) {
8197
+ _this.props.videoElement.pause();
8280
8198
  }
8281
8199
  };
8282
- _this1.stop = function() {
8283
- _this1.pause();
8284
- if (_this1.props.videoElement) {
8285
- _this1.props.videoElement.currentTime = 0;
8200
+ _this.stop = function() {
8201
+ _this.pause();
8202
+ if (_this.props.videoElement) {
8203
+ _this.props.videoElement.currentTime = 0;
8286
8204
  }
8287
8205
  };
8288
- _this1.seekTo = function(seconds, keepPlaying) {
8289
- if (_this1.props.videoElement) {
8290
- _this1.props.videoElement.currentTime = seconds;
8206
+ _this.seekTo = function(seconds, keepPlaying) {
8207
+ if (_this.props.videoElement) {
8208
+ _this.props.videoElement.currentTime = seconds;
8291
8209
  if (!keepPlaying) {
8292
- _this1.pause();
8210
+ _this.pause();
8293
8211
  }
8294
8212
  }
8295
8213
  };
8296
- _this1.setVolume = function(volume) {
8297
- if (_this1.props.videoElement) {
8298
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8214
+ _this.setVolume = function(volume) {
8215
+ if (_this.props.videoElement) {
8216
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8299
8217
  }
8300
8218
  };
8301
- _this1.mute = function() {
8302
- if (_this1.props.videoElement) {
8303
- _this1.props.videoElement.muted = true;
8219
+ _this.mute = function() {
8220
+ if (_this.props.videoElement) {
8221
+ _this.props.videoElement.muted = true;
8304
8222
  }
8305
8223
  };
8306
- _this1.unmute = function() {
8307
- if (_this1.props.videoElement) {
8308
- _this1.props.videoElement.muted = false;
8224
+ _this.unmute = function() {
8225
+ if (_this.props.videoElement) {
8226
+ _this.props.videoElement.muted = false;
8309
8227
  }
8310
8228
  };
8311
- _this1.setPlaybackRate = function(rate) {
8312
- if (_this1.props.videoElement && rate > 0) {
8313
- _this1.props.videoElement.playbackRate = rate;
8229
+ _this.setPlaybackRate = function(rate) {
8230
+ if (_this.props.videoElement && rate > 0) {
8231
+ _this.props.videoElement.playbackRate = rate;
8314
8232
  }
8315
8233
  };
8316
- _this1.setLoop = function(loop) {
8317
- if (_this1.props.videoElement) {
8318
- _this1.props.videoElement.loop = loop;
8234
+ _this.setLoop = function(loop) {
8235
+ if (_this.props.videoElement) {
8236
+ _this.props.videoElement.loop = loop;
8319
8237
  }
8320
8238
  };
8321
- _this1.getDuration = function() {
8322
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
8323
- return _this1.props.videoElement.duration;
8239
+ _this.getDuration = function() {
8240
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
8241
+ return _this.props.videoElement.duration;
8324
8242
  }
8325
8243
  return null;
8326
8244
  };
8327
- _this1.getCurrentTime = function() {
8328
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
8329
- return _this1.props.videoElement.currentTime;
8245
+ _this.getCurrentTime = function() {
8246
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
8247
+ return _this.props.videoElement.currentTime;
8330
8248
  }
8331
8249
  return null;
8332
8250
  };
8333
- _this1.getSecondsLoaded = function() {
8334
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
8335
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
8251
+ _this.getSecondsLoaded = function() {
8252
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
8253
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
8336
8254
  }
8337
8255
  return null;
8338
8256
  };
8339
- _this1.getInternalPlayer = function() {
8257
+ _this.getInternalPlayer = function() {
8340
8258
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
8341
- if (key === "video") return _this1.props.videoElement;
8259
+ if (key === "video") return _this.props.videoElement;
8342
8260
  return null;
8343
8261
  };
8344
- _this1.enablePIP = function() {
8262
+ _this.enablePIP = function() {
8345
8263
  return _async_to_generator(function() {
8346
8264
  var error;
8347
8265
  return _ts_generator(this, function(_state) {
@@ -8384,7 +8302,7 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
8384
8302
  });
8385
8303
  })();
8386
8304
  };
8387
- _this1.disablePIP = function() {
8305
+ _this.disablePIP = function() {
8388
8306
  return _async_to_generator(function() {
8389
8307
  var error;
8390
8308
  return _ts_generator(this, function(_state) {
@@ -8478,7 +8396,7 @@ var players = [
8478
8396
  key: "file",
8479
8397
  name: "File Player",
8480
8398
  canPlay: canPlay.file,
8481
- canEnablePIP: function(url) {
8399
+ canEnablePIP: function canEnablePIP(url) {
8482
8400
  return canPlay.file(url) && (document.pictureInPictureEnabled || typeof document.webkitSupportsPresentationMode === "function");
8483
8401
  },
8484
8402
  lazyPlayer: lazy(function() {