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/HlsPlayer.tsx
385
393
  var HlsPlayer_exports = {};
386
394
  __export(HlsPlayer_exports, {
387
- default: function() {
395
+ default: function _default() {
388
396
  return HlsPlayer;
389
397
  }
390
398
  });
@@ -719,7 +727,7 @@ function createImaController(video, options) {
719
727
  var fn = _step.value;
720
728
  try {
721
729
  fn(payload);
722
- } catch (e) {}
730
+ } catch (unused) {}
723
731
  }
724
732
  } catch (err) {
725
733
  _didIteratorError = true;
@@ -757,7 +765,7 @@ function createImaController(video, options) {
757
765
  console.error("StormcloudVideoPlayer: The host page is inside a sandboxed iframe without 'allow-scripts'. Google IMA cannot run ads within sandboxed frames. Remove the sandbox attribute or include 'allow-scripts allow-same-origin'.");
758
766
  }
759
767
  }
760
- } catch (e) {}
768
+ } catch (unused) {}
761
769
  if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
762
770
  var existing = document.querySelector('script[data-ima="true"]');
763
771
  if (existing) {
@@ -1005,7 +1013,7 @@ function createImaController(video, options) {
1005
1013
  if (adsManager) {
1006
1014
  try {
1007
1015
  adsManager.destroy();
1008
- } catch (e) {}
1016
+ } catch (unused) {}
1009
1017
  adsManager = void 0;
1010
1018
  }
1011
1019
  if (adVideoElement) {
@@ -1016,7 +1024,7 @@ function createImaController(video, options) {
1016
1024
  if (adsLoader) {
1017
1025
  try {
1018
1026
  adsLoader.destroy();
1019
- } catch (e) {}
1027
+ } catch (unused) {}
1020
1028
  adsLoader = void 0;
1021
1029
  }
1022
1030
  }
@@ -1034,7 +1042,7 @@ function createImaController(video, options) {
1034
1042
  try {
1035
1043
  var _adDisplayContainer_initialize;
1036
1044
  (_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
1037
- } catch (e) {}
1045
+ } catch (unused) {}
1038
1046
  }
1039
1047
  }).catch(function() {});
1040
1048
  },
@@ -1193,7 +1201,7 @@ function createImaController(video, options) {
1193
1201
  window.setTimeout(function() {
1194
1202
  try {
1195
1203
  makeAdsRequest(google, lastAdTagUrl);
1196
- } catch (e) {}
1204
+ } catch (unused) {}
1197
1205
  }, delay);
1198
1206
  } else {
1199
1207
  emit("ad_error", {
@@ -1225,7 +1233,7 @@ function createImaController(video, options) {
1225
1233
  if (adsManager) {
1226
1234
  try {
1227
1235
  adsManager.setVolume(adVolume);
1228
- } catch (e) {}
1236
+ } catch (unused) {}
1229
1237
  }
1230
1238
  emit("content_pause");
1231
1239
  });
@@ -1239,7 +1247,7 @@ function createImaController(video, options) {
1239
1247
  if (adsManager) {
1240
1248
  try {
1241
1249
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1242
- } catch (e) {}
1250
+ } catch (unused) {}
1243
1251
  }
1244
1252
  }
1245
1253
  if (adContainerEl) {
@@ -1400,7 +1408,7 @@ function createImaController(video, options) {
1400
1408
  }
1401
1409
  try {
1402
1410
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1403
- } catch (e) {}
1411
+ } catch (unused) {}
1404
1412
  adsManager.start();
1405
1413
  return [
1406
1414
  2,
@@ -1482,7 +1490,7 @@ function createImaController(video, options) {
1482
1490
  try {
1483
1491
  ;
1484
1492
  adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
1485
- } catch (e) {}
1493
+ } catch (unused) {}
1486
1494
  destroyAdsManager();
1487
1495
  return [
1488
1496
  2
@@ -1513,7 +1521,7 @@ function createImaController(video, options) {
1513
1521
  try {
1514
1522
  var _adsLoader_destroy;
1515
1523
  adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
1516
- } catch (e) {}
1524
+ } catch (unused) {}
1517
1525
  adDisplayContainer = void 0;
1518
1526
  adsLoader = void 0;
1519
1527
  contentVideoHidden = false;
@@ -1562,7 +1570,7 @@ function createImaController(video, options) {
1562
1570
  if (adsManager && adPlaying) {
1563
1571
  try {
1564
1572
  adsManager.setVolume(clampedVolume);
1565
- } catch (e) {}
1573
+ } catch (unused) {}
1566
1574
  }
1567
1575
  },
1568
1576
  getAdVolume: function getAdVolume() {
@@ -2475,12 +2483,12 @@ function createHlsAdPlayer(contentVideo, options) {
2475
2483
  }
2476
2484
  // src/sdk/prebid.ts
2477
2485
  var DEFAULT_TIMEOUT_MS = 3e3;
2478
- var AUCTION_PATH = "/openrtb2/auction";
2479
- function createPrebidManager(config) {
2486
+ var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
2487
+ function createPrebidManager() {
2488
+ var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2489
+ var _options_debug;
2480
2490
  var initialized = false;
2481
- var serverUrl = "";
2482
- var _config_debug;
2483
- var debug = (_config_debug = config.debug) !== null && _config_debug !== void 0 ? _config_debug : false;
2491
+ var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
2484
2492
  function log() {
2485
2493
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2486
2494
  args[_key] = arguments[_key];
@@ -2501,49 +2509,6 @@ function createPrebidManager(config) {
2501
2509
  "[Prebid]"
2502
2510
  ].concat(_to_consumable_array(args)));
2503
2511
  }
2504
- function resolveServerUrl() {
2505
- var _config_ortbRequest_ext_prebid_server, _config_ortbRequest_ext_prebid, _config_ortbRequest_ext, _config_ortbRequest;
2506
- if (config.serverUrl) {
2507
- return config.serverUrl.replace(/\/$/, "");
2508
- }
2509
- 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;
2510
- if (typeof extUrl === "string" && extUrl.length > 0) {
2511
- return extUrl.replace(/\/$/, "");
2512
- }
2513
- throw new Error("Prebid Server URL not configured. Provide serverUrl in PrebidConfig or ext.prebid.server.externalurl in the OpenRTB request.");
2514
- }
2515
- function buildRequest() {
2516
- var req = JSON.parse(JSON.stringify(config.ortbRequest));
2517
- req.id = "".concat(req.id || "prebid", "-").concat(Date.now(), "-").concat(Math.random().toString(36).slice(2, 8));
2518
- if (!req.ext) req.ext = {};
2519
- if (!req.ext.prebid) req.ext.prebid = {};
2520
- if (!req.ext.prebid.cache) req.ext.prebid.cache = {};
2521
- if (!req.ext.prebid.cache.vastxml) req.ext.prebid.cache.vastxml = {};
2522
- if (!req.ext.prebid.targeting) {
2523
- req.ext.prebid.targeting = {
2524
- includewinners: true,
2525
- includebidderkeys: false
2526
- };
2527
- }
2528
- if (!req.device) req.device = {};
2529
- if (typeof navigator !== "undefined") {
2530
- if (!req.device.ua) req.device.ua = navigator.userAgent;
2531
- if (!req.device.language) {
2532
- req.device.language = (navigator.language || "").split("-")[0] || "en";
2533
- }
2534
- }
2535
- if (typeof window !== "undefined") {
2536
- var _window_screen, _window_screen1;
2537
- if (!req.device.w) req.device.w = ((_window_screen = window.screen) === null || _window_screen === void 0 ? void 0 : _window_screen.width) || window.innerWidth;
2538
- if (!req.device.h) req.device.h = ((_window_screen1 = window.screen) === null || _window_screen1 === void 0 ? void 0 : _window_screen1.height) || window.innerHeight;
2539
- }
2540
- if (!req.site) req.site = {};
2541
- if (typeof window !== "undefined") {
2542
- if (!req.site.page) req.site.page = window.location.href;
2543
- if (!req.site.domain) req.site.domain = window.location.hostname;
2544
- }
2545
- return req;
2546
- }
2547
2512
  function parseResponse(data) {
2548
2513
  var bids = [];
2549
2514
  var seatbids = (data === null || data === void 0 ? void 0 : data.seatbid) || [];
@@ -2613,12 +2578,6 @@ function createPrebidManager(config) {
2613
2578
  function extractVastUrl(bids) {
2614
2579
  if (bids.length === 0) return null;
2615
2580
  var winner = bids[0];
2616
- var _config_cpmFloor;
2617
- var cpmFloor = (_config_cpmFloor = config.cpmFloor) !== null && _config_cpmFloor !== void 0 ? _config_cpmFloor : 0;
2618
- if (cpmFloor > 0 && winner.cpm < cpmFloor) {
2619
- log("Winning bid $".concat(winner.cpm.toFixed(2), " below CPM floor $").concat(cpmFloor.toFixed(2), ", rejecting"));
2620
- return null;
2621
- }
2622
2581
  if (winner.vastUrl) {
2623
2582
  log("Using cached VAST URL from ".concat(winner.bidder, " ($").concat(winner.cpm.toFixed(2), " ").concat(winner.currency, ")"));
2624
2583
  return winner.vastUrl;
@@ -2640,22 +2599,12 @@ function createPrebidManager(config) {
2640
2599
  }
2641
2600
  function initialize() {
2642
2601
  return _async_to_generator(function() {
2643
- var _config_ortbRequest;
2644
2602
  return _ts_generator(this, function(_state) {
2645
2603
  if (initialized) return [
2646
2604
  2
2647
2605
  ];
2648
- serverUrl = resolveServerUrl();
2649
- if (!((_config_ortbRequest = config.ortbRequest) === null || _config_ortbRequest === void 0 ? void 0 : _config_ortbRequest.imp) || config.ortbRequest.imp.length === 0) {
2650
- throw new Error("No impressions (imp) defined in the OpenRTB request.");
2651
- }
2652
2606
  initialized = true;
2653
- log("Initialized with server:", serverUrl);
2654
- log("Bidders:", config.ortbRequest.imp.map(function(imp) {
2655
- var _imp_ext_prebid, _imp_ext;
2656
- 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;
2657
- return bidders ? Object.keys(bidders).join(", ") : "none";
2658
- }).join("; "));
2607
+ log("Initialized, auction URL:", AUCTION_URL);
2659
2608
  return [
2660
2609
  2
2661
2610
  ];
@@ -2664,17 +2613,15 @@ function createPrebidManager(config) {
2664
2613
  }
2665
2614
  function requestBids() {
2666
2615
  return _async_to_generator(function() {
2667
- 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;
2616
+ var timeout, controller, timeoutId, _data_ext, _data_ext1, fetchOptions, response, body, data, bids, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, b, error;
2668
2617
  return _ts_generator(this, function(_state) {
2669
2618
  switch(_state.label){
2670
2619
  case 0:
2671
2620
  if (!initialized) {
2672
2621
  throw new Error("Prebid not initialized. Call initialize() first.");
2673
2622
  }
2674
- auctionUrl = "".concat(serverUrl).concat(AUCTION_PATH);
2675
- request = buildRequest();
2676
- timeout = (_ref = (_config_timeout = config.timeout) !== null && _config_timeout !== void 0 ? _config_timeout : config.ortbRequest.tmax) !== null && _ref !== void 0 ? _ref : DEFAULT_TIMEOUT_MS;
2677
- log("Sending auction request to:", auctionUrl);
2623
+ timeout = DEFAULT_TIMEOUT_MS;
2624
+ log("Fetching auction response from:", AUCTION_URL);
2678
2625
  controller = typeof AbortController !== "undefined" ? new AbortController() : null;
2679
2626
  timeoutId = setTimeout(function() {
2680
2627
  controller === null || controller === void 0 ? void 0 : controller.abort();
@@ -2688,18 +2635,14 @@ function createPrebidManager(config) {
2688
2635
  7
2689
2636
  ]);
2690
2637
  fetchOptions = {
2691
- method: "POST",
2692
- headers: {
2693
- "Content-Type": "application/json"
2694
- },
2695
- body: JSON.stringify(request)
2638
+ method: "POST"
2696
2639
  };
2697
2640
  if (controller) {
2698
2641
  fetchOptions.signal = controller.signal;
2699
2642
  }
2700
2643
  return [
2701
2644
  4,
2702
- fetch(auctionUrl, fetchOptions)
2645
+ fetch(AUCTION_URL, fetchOptions)
2703
2646
  ];
2704
2647
  case 2:
2705
2648
  response = _state.sent();
@@ -2816,7 +2759,6 @@ function createPrebidManager(config) {
2816
2759
  }
2817
2760
  function destroy() {
2818
2761
  initialized = false;
2819
- serverUrl = "";
2820
2762
  log("Destroyed");
2821
2763
  }
2822
2764
  return {
@@ -2832,7 +2774,7 @@ function createPrebidManager(config) {
2832
2774
  // src/sdk/prebidController.ts
2833
2775
  var import_hls2 = __toESM(require("hls.js"), 1);
2834
2776
  var LOG = "[PrebidController]";
2835
- function createPrebidController(contentVideo, prebidConfig, options) {
2777
+ function createPrebidController(contentVideo, options) {
2836
2778
  var adPlaying = false;
2837
2779
  var originalMutedState = false;
2838
2780
  var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
@@ -2846,11 +2788,9 @@ function createPrebidController(contentVideo, prebidConfig, options) {
2846
2788
  var sessionId;
2847
2789
  var destroyed = false;
2848
2790
  var trackingFired = createEmptyTrackingState();
2849
- var _prebidConfig_debug;
2850
- var prebidDebug = (_prebidConfig_debug = prebidConfig.debug) !== null && _prebidConfig_debug !== void 0 ? _prebidConfig_debug : false;
2851
- var prebidManager = createPrebidManager(_object_spread_props(_object_spread({}, prebidConfig), {
2852
- debug: prebidDebug
2853
- }));
2791
+ var prebidManager = createPrebidManager((options === null || options === void 0 ? void 0 : options.debug) !== void 0 ? {
2792
+ debug: options.debug
2793
+ } : {});
2854
2794
  var prebidInitialized = false;
2855
2795
  function emit(event, payload) {
2856
2796
  var set = listeners.get(event);
@@ -3049,6 +2989,8 @@ function createPrebidController(contentVideo, prebidConfig, options) {
3049
2989
  adContainerEl.style.display = "none";
3050
2990
  adContainerEl.style.pointerEvents = "none";
3051
2991
  }
2992
+ contentVideo.style.visibility = "visible";
2993
+ contentVideo.style.opacity = "1";
3052
2994
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
3053
2995
  if (contentVideo.paused) {
3054
2996
  console.log("".concat(LOG, " Content video paused in live mode, resuming playback"));
@@ -3073,19 +3015,12 @@ function createPrebidController(contentVideo, prebidConfig, options) {
3073
3015
  }
3074
3016
  function ensurePrebidInitialized() {
3075
3017
  return _async_to_generator(function() {
3076
- var _prebidConfig_ortbRequest_imp, _prebidConfig_ortbRequest;
3077
3018
  return _ts_generator(this, function(_state) {
3078
3019
  switch(_state.label){
3079
3020
  case 0:
3080
3021
  if (prebidInitialized) return [
3081
3022
  2
3082
3023
  ];
3083
- if (prebidConfig.enabled === false) {
3084
- throw new Error("Prebid is disabled in config");
3085
- }
3086
- 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)) {
3087
- throw new Error("No impressions configured in ortbRequest");
3088
- }
3089
3024
  return [
3090
3025
  4,
3091
3026
  prebidManager.initialize()
@@ -3103,7 +3038,7 @@ function createPrebidController(contentVideo, prebidConfig, options) {
3103
3038
  }
3104
3039
  function runPrebidAuction() {
3105
3040
  return _async_to_generator(function() {
3106
- var bids, _prebidConfig_cpmFloor, cpmFloor, winner;
3041
+ var bids, winner;
3107
3042
  return _ts_generator(this, function(_state) {
3108
3043
  switch(_state.label){
3109
3044
  case 0:
@@ -3126,15 +3061,7 @@ function createPrebidController(contentVideo, prebidConfig, options) {
3126
3061
  null
3127
3062
  ];
3128
3063
  }
3129
- cpmFloor = (_prebidConfig_cpmFloor = prebidConfig.cpmFloor) !== null && _prebidConfig_cpmFloor !== void 0 ? _prebidConfig_cpmFloor : 0;
3130
3064
  winner = bids[0];
3131
- if (cpmFloor > 0 && winner.cpm < cpmFloor) {
3132
- console.log("".concat(LOG, " Winning bid $").concat(winner.cpm.toFixed(2), " below CPM floor $").concat(cpmFloor.toFixed(2), ", rejecting"));
3133
- return [
3134
- 2,
3135
- null
3136
- ];
3137
- }
3138
3065
  console.log("".concat(LOG, " Winning bid: ").concat(winner.bidder, " $").concat(winner.cpm.toFixed(2), " ").concat(winner.currency));
3139
3066
  if (winner.vastXml) {
3140
3067
  console.log("".concat(LOG, " Parsing VAST XML from bid response (inline)"));
@@ -4239,22 +4166,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4239
4166
  adPlayerType = "hls";
4240
4167
  }
4241
4168
  if (adPlayerType === "prebid") {
4242
- if (!this.config.prebid) {
4243
- console.warn("[StormcloudVideoPlayer] adPlayerType is 'prebid' but no prebid config provided, falling back to HLS ad player");
4244
- return createHlsAdPlayer(this.video, _object_spread({
4245
- continueLiveStreamDuringAds: continueLiveStreamDuringAds
4246
- }, this.config.licenseKey ? {
4247
- licenseKey: this.config.licenseKey
4248
- } : {}, this.hls ? {
4249
- mainHlsInstance: this.hls
4250
- } : {}));
4251
- }
4252
4169
  if (this.config.debugAdTiming) {
4253
4170
  console.log("[StormcloudVideoPlayer] Creating Prebid ad controller (standalone, no IMA SDK)");
4254
4171
  }
4255
- return createPrebidController(this.video, this.config.prebid, _object_spread({
4172
+ return createPrebidController(this.video, _object_spread({
4256
4173
  continueLiveStreamDuringAds: continueLiveStreamDuringAds
4257
- }, this.config.licenseKey ? {
4174
+ }, this.config.debugAdTiming !== void 0 ? {
4175
+ debug: this.config.debugAdTiming
4176
+ } : {}, this.config.licenseKey ? {
4258
4177
  licenseKey: this.config.licenseKey
4259
4178
  } : {}, this.hls ? {
4260
4179
  mainHlsInstance: this.hls
@@ -4380,7 +4299,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4380
4299
  });
4381
4300
  this.hls.on(import_hls3.default.Events.MANIFEST_PARSED, function(_, data) {
4382
4301
  return _async_to_generator(function() {
4383
- var _this_hls_levels, _this_hls, _this_hls_levels_some, adBehavior, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
4302
+ var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
4384
4303
  return _ts_generator(this, function(_state) {
4385
4304
  switch(_state.label){
4386
4305
  case 0:
@@ -4389,10 +4308,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4389
4308
  } else {
4390
4309
  ;
4391
4310
  ;
4392
- this.isLiveStream = (_this_hls_levels_some = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
4311
+ this.isLiveStream = (_ref = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
4393
4312
  var _level_details, _level_details1;
4394
4313
  return (level === null || level === void 0 ? void 0 : (_level_details = level.details) === null || _level_details === void 0 ? void 0 : _level_details.live) === true || (level === null || level === void 0 ? void 0 : (_level_details1 = level.details) === null || _level_details1 === void 0 ? void 0 : _level_details1.type) === "LIVE";
4395
- })) !== null && _this_hls_levels_some !== void 0 ? _this_hls_levels_some : false;
4314
+ })) !== null && _ref !== void 0 ? _ref : false;
4396
4315
  }
4397
4316
  if (this.config.debugAdTiming) {
4398
4317
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -4456,9 +4375,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4456
4375
  var tag = "";
4457
4376
  var value = "";
4458
4377
  if (Array.isArray(entry)) {
4459
- var _entry_;
4378
+ var _entry_, _entry_1;
4460
4379
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4461
- var _entry_1;
4462
4380
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4463
4381
  } else if (typeof entry === "string") {
4464
4382
  var idx = entry.indexOf(":");
@@ -4581,9 +4499,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4581
4499
  var tag = "";
4582
4500
  var value = "";
4583
4501
  if (Array.isArray(entry)) {
4584
- var _entry_;
4502
+ var _entry_, _entry_1;
4585
4503
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4586
- var _entry_1;
4587
4504
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4588
4505
  } else if (typeof entry === "string") {
4589
4506
  var idx = entry.indexOf(":");
@@ -4633,10 +4550,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4633
4550
  }
4634
4551
  });
4635
4552
  } else if (tag.includes("EXT-X-DATERANGE")) {
4553
+ var _attrs_CLASS;
4636
4554
  var attrs = _this.parseAttributeList(value);
4637
4555
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4638
4556
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4639
- var _attrs_CLASS;
4640
4557
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4641
4558
  var duration = _this.toNumber(attrs["DURATION"]);
4642
4559
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -5038,11 +4955,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5038
4955
  }
5039
4956
  var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
5040
4957
  if (daterangeMatch) {
5041
- var _daterangeMatch_;
4958
+ var _daterangeMatch_, _attrs_CLASS;
5042
4959
  var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
5043
4960
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
5044
4961
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
5045
- var _attrs_CLASS;
5046
4962
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
5047
4963
  var duration = this.toNumber(attrs["DURATION"]);
5048
4964
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -5118,7 +5034,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5118
5034
  var out = "";
5119
5035
  for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
5120
5036
  return out;
5121
- } catch (e) {
5037
+ } catch (unused) {
5122
5038
  return void 0;
5123
5039
  }
5124
5040
  }
@@ -5137,6 +5053,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5137
5053
  });
5138
5054
  }
5139
5055
  if (marker.type === "start") {
5056
+ var _this_config_immediateManifestAds;
5140
5057
  var _this_pendingAdBreak;
5141
5058
  if (!this.video.muted) {
5142
5059
  this.video.muted = true;
@@ -5161,7 +5078,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5161
5078
  this.expectedAdBreakDurationMs = durationMs;
5162
5079
  this.currentAdBreakStartWallClockMs = Date.now();
5163
5080
  var isManifestMarker = this.isManifestBasedMarker(marker);
5164
- var _this_config_immediateManifestAds;
5165
5081
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
5166
5082
  if (this.config.debugAdTiming) {
5167
5083
  console.log("[StormcloudVideoPlayer] Ad start decision:", {
@@ -5316,9 +5232,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5316
5232
  var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
5317
5233
  var match;
5318
5234
  while((match = regex.exec(value)) !== null){
5319
- var _match_;
5235
+ var _match_, _ref, _match_1;
5320
5236
  var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
5321
- var _match_1, _ref;
5322
5237
  var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
5323
5238
  if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
5324
5239
  rawVal = rawVal.slice(1, -1);
@@ -5677,13 +5592,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5677
5592
  {
5678
5593
  key: "shouldShowNativeControls",
5679
5594
  value: function shouldShowNativeControls() {
5595
+ var _this_config_showCustomControls;
5680
5596
  var streamType = this.getStreamType();
5681
5597
  if (streamType === "other") {
5682
- var _this_config_showCustomControls;
5683
- return !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false);
5598
+ var _this_config_showCustomControls1;
5599
+ return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
5684
5600
  }
5685
- var _this_config_showCustomControls1;
5686
- return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
5601
+ return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
5687
5602
  }
5688
5603
  },
5689
5604
  {
@@ -5842,12 +5757,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5842
5757
  continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
5843
5758
  preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
5844
5759
  preloadIma.initialize();
5845
- errorListener = function(payload) {
5760
+ errorListener = function errorListener(payload) {
5846
5761
  hasAdError = true;
5847
5762
  adErrorPayload = payload;
5848
5763
  };
5849
5764
  preloadIma.on("ad_error", errorListener);
5850
- errorListenerCleanup = function() {
5765
+ errorListenerCleanup = function errorListenerCleanup() {
5851
5766
  return preloadIma.off("ad_error", errorListener);
5852
5767
  };
5853
5768
  return [
@@ -5898,7 +5813,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5898
5813
  isReady: true,
5899
5814
  loadPromise: Promise.resolve()
5900
5815
  };
5901
- lateErrorListener = function(payload) {
5816
+ lateErrorListener = function lateErrorListener(payload) {
5902
5817
  var index = _this.preloadPool.findIndex(function(entry) {
5903
5818
  return entry.vastUrl === vastUrl;
5904
5819
  });
@@ -5909,7 +5824,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5909
5824
  }
5910
5825
  try {
5911
5826
  preloadIma.destroy();
5912
- } catch (e) {}
5827
+ } catch (unused) {}
5913
5828
  }
5914
5829
  };
5915
5830
  preloadIma.on("ad_error", lateErrorListener);
@@ -6734,7 +6649,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6734
6649
  10
6735
6650
  ];
6736
6651
  nextAdUrl = this.adRequestQueue.shift();
6737
- if (!nextAdUrl) {
6652
+ if (nextAdUrl == null) {
6738
6653
  return [
6739
6654
  3,
6740
6655
  4
@@ -6920,7 +6835,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6920
6835
  9
6921
6836
  ];
6922
6837
  nextAdUrl = this.adRequestQueue.shift();
6923
- if (!nextAdUrl) {
6838
+ if (nextAdUrl == null) {
6924
6839
  return [
6925
6840
  3,
6926
6841
  3
@@ -7125,11 +7040,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7125
7040
  {
7126
7041
  key: "ensureAdStoppedByTimer",
7127
7042
  value: function ensureAdStoppedByTimer() {
7043
+ var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
7128
7044
  if (!this.inAdBreak) return;
7129
7045
  this.adStopTimerId = void 0;
7130
7046
  var adPlaying = this.ima.isAdPlaying();
7131
7047
  var pendingAds = this.adPodQueue.length > 0;
7132
- var _this_config_adBreakCheckIntervalMs;
7133
7048
  var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
7134
7049
  var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
7135
7050
  var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
@@ -7137,7 +7052,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7137
7052
  if (this.currentAdBreakStartWallClockMs != null) {
7138
7053
  elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
7139
7054
  }
7140
- var _this_expectedAdBreakDurationMs;
7141
7055
  var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
7142
7056
  var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
7143
7057
  var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
@@ -7394,15 +7308,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7394
7308
  9
7395
7309
  ];
7396
7310
  case 9:
7397
- if (this.isTemporaryAdError(playError)) {
7398
- this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7399
- if (this.config.debugAdTiming) {
7400
- console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
7401
- }
7402
- } else {
7403
- this.failedVastUrls.add(vastTagUrl);
7404
- if (this.config.debugAdTiming) {
7405
- console.log("[AD-ERROR] Permanent play error - URL blacklisted");
7311
+ if (vastTagUrl) {
7312
+ if (this.isTemporaryAdError(playError)) {
7313
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7314
+ if (this.config.debugAdTiming) {
7315
+ console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
7316
+ }
7317
+ } else {
7318
+ this.failedVastUrls.add(vastTagUrl);
7319
+ if (this.config.debugAdTiming) {
7320
+ console.log("[AD-ERROR] Permanent play error - URL blacklisted");
7321
+ }
7406
7322
  }
7407
7323
  }
7408
7324
  this.clearAdFailsafeTimer();
@@ -7471,15 +7387,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7471
7387
  15
7472
7388
  ];
7473
7389
  case 15:
7474
- if (this.isTemporaryAdError(error)) {
7475
- this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7476
- if (this.config.debugAdTiming) {
7477
- console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
7478
- }
7479
- } else {
7480
- this.failedVastUrls.add(vastTagUrl);
7481
- if (this.config.debugAdTiming) {
7482
- console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
7390
+ if (vastTagUrl) {
7391
+ if (this.isTemporaryAdError(error)) {
7392
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7393
+ if (this.config.debugAdTiming) {
7394
+ console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
7395
+ }
7396
+ } else {
7397
+ this.failedVastUrls.add(vastTagUrl);
7398
+ if (this.config.debugAdTiming) {
7399
+ console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
7400
+ }
7483
7401
  }
7484
7402
  }
7485
7403
  this.clearAdRequestWatchdog();
@@ -7582,8 +7500,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7582
7500
  key: "startAdRequestWatchdog",
7583
7501
  value: function startAdRequestWatchdog(token) {
7584
7502
  var _this = this;
7585
- this.clearAdRequestWatchdog();
7586
7503
  var _this_config_adFailsafeTimeoutMs;
7504
+ this.clearAdRequestWatchdog();
7587
7505
  var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7588
7506
  this.adRequestWatchdogToken = token;
7589
7507
  this.adRequestWatchdogId = window.setTimeout(function() {
@@ -7626,8 +7544,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7626
7544
  key: "startAdFailsafeTimer",
7627
7545
  value: function startAdFailsafeTimer(token) {
7628
7546
  var _this = this;
7629
- this.clearAdFailsafeTimer();
7630
7547
  var _this_config_adFailsafeTimeoutMs;
7548
+ this.clearAdFailsafeTimer();
7631
7549
  var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7632
7550
  this.adFailsafeToken = token;
7633
7551
  this.adFailsafeTimerId = window.setTimeout(function() {
@@ -7948,23 +7866,23 @@ var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
7948
7866
  var VIDEO_EXTENSIONS = /\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\?)/i;
7949
7867
  var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\?)/i;
7950
7868
  var canPlay = {
7951
- hls: function(url) {
7869
+ hls: function hls(url) {
7952
7870
  if (!url || typeof url !== "string") return false;
7953
7871
  return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);
7954
7872
  },
7955
- dash: function(url) {
7873
+ dash: function dash(url) {
7956
7874
  if (!url || typeof url !== "string") return false;
7957
7875
  return DASH_EXTENSIONS.test(url);
7958
7876
  },
7959
- video: function(url) {
7877
+ video: function video(url) {
7960
7878
  if (!url || typeof url !== "string") return false;
7961
7879
  return VIDEO_EXTENSIONS.test(url);
7962
7880
  },
7963
- audio: function(url) {
7881
+ audio: function audio(url) {
7964
7882
  if (!url || typeof url !== "string") return false;
7965
7883
  return AUDIO_EXTENSIONS.test(url);
7966
7884
  },
7967
- file: function(url) {
7885
+ file: function file(url) {
7968
7886
  if (!url || typeof url !== "string") return false;
7969
7887
  return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);
7970
7888
  }
@@ -7975,11 +7893,11 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react_Component) {
7975
7893
  function HlsPlayer() {
7976
7894
  _class_call_check(this, HlsPlayer);
7977
7895
  var _this;
7978
- var _this1, _arguments = arguments;
7979
- _this = _call_super(this, HlsPlayer, _to_consumable_array(_arguments)), _this1 = _this;
7980
- _this1.player = null;
7981
- _this1.mounted = false;
7982
- _this1.load = function() {
7896
+ var _this1;
7897
+ _this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
7898
+ _this.player = null;
7899
+ _this.mounted = false;
7900
+ _this.load = function() {
7983
7901
  return _async_to_generator(function() {
7984
7902
  var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
7985
7903
  return _ts_generator(this, function(_state) {
@@ -8052,87 +7970,87 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react_Component) {
8052
7970
  });
8053
7971
  })();
8054
7972
  };
8055
- _this1.play = function() {
8056
- if (_this1.props.videoElement) {
8057
- var video = _this1.props.videoElement;
7973
+ _this.play = function() {
7974
+ if (_this.props.videoElement) {
7975
+ var video = _this.props.videoElement;
8058
7976
  var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
8059
7977
  if (hasValidSource) {
8060
7978
  var _video_play, _this_props_onPlay, _this_props;
8061
7979
  (_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
8062
7980
  var _this_props_onError, _this_props;
8063
7981
  console.error("[HlsPlayer] Failed to play:", error);
8064
- (_this_props_onError = (_this_props = _this1.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
7982
+ (_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
8065
7983
  });
8066
- (_this_props_onPlay = (_this_props = _this1.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
7984
+ (_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
8067
7985
  } else {
8068
7986
  console.warn("[HlsPlayer] Cannot play: video has no valid source");
8069
7987
  }
8070
7988
  }
8071
7989
  };
8072
- _this1.pause = function() {
8073
- if (_this1.props.videoElement) {
7990
+ _this.pause = function() {
7991
+ if (_this.props.videoElement) {
8074
7992
  var _this_props_onPause, _this_props;
8075
- _this1.props.videoElement.pause();
8076
- (_this_props_onPause = (_this_props = _this1.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
7993
+ _this.props.videoElement.pause();
7994
+ (_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
8077
7995
  }
8078
7996
  };
8079
- _this1.stop = function() {
8080
- _this1.pause();
8081
- if (_this1.props.videoElement) {
8082
- _this1.props.videoElement.currentTime = 0;
7997
+ _this.stop = function() {
7998
+ _this.pause();
7999
+ if (_this.props.videoElement) {
8000
+ _this.props.videoElement.currentTime = 0;
8083
8001
  }
8084
8002
  };
8085
- _this1.seekTo = function(seconds, keepPlaying) {
8086
- if (_this1.props.videoElement) {
8087
- _this1.props.videoElement.currentTime = seconds;
8003
+ _this.seekTo = function(seconds, keepPlaying) {
8004
+ if (_this.props.videoElement) {
8005
+ _this.props.videoElement.currentTime = seconds;
8088
8006
  if (!keepPlaying) {
8089
- _this1.pause();
8007
+ _this.pause();
8090
8008
  }
8091
8009
  }
8092
8010
  };
8093
- _this1.setVolume = function(volume) {
8094
- if (_this1.props.videoElement) {
8095
- _this1.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8011
+ _this.setVolume = function(volume) {
8012
+ if (_this.props.videoElement) {
8013
+ _this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
8096
8014
  }
8097
8015
  };
8098
- _this1.mute = function() {
8099
- if (_this1.props.videoElement) {
8100
- _this1.props.videoElement.muted = true;
8016
+ _this.mute = function() {
8017
+ if (_this.props.videoElement) {
8018
+ _this.props.videoElement.muted = true;
8101
8019
  }
8102
8020
  };
8103
- _this1.unmute = function() {
8104
- if (_this1.props.videoElement) {
8105
- _this1.props.videoElement.muted = false;
8021
+ _this.unmute = function() {
8022
+ if (_this.props.videoElement) {
8023
+ _this.props.videoElement.muted = false;
8106
8024
  }
8107
8025
  };
8108
- _this1.setPlaybackRate = function(rate) {
8109
- if (_this1.props.videoElement && rate > 0) {
8110
- _this1.props.videoElement.playbackRate = rate;
8026
+ _this.setPlaybackRate = function(rate) {
8027
+ if (_this.props.videoElement && rate > 0) {
8028
+ _this.props.videoElement.playbackRate = rate;
8111
8029
  }
8112
8030
  };
8113
- _this1.getDuration = function() {
8114
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.duration)) {
8115
- return _this1.props.videoElement.duration;
8031
+ _this.getDuration = function() {
8032
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
8033
+ return _this.props.videoElement.duration;
8116
8034
  }
8117
8035
  return null;
8118
8036
  };
8119
- _this1.getCurrentTime = function() {
8120
- if (_this1.props.videoElement && isFinite(_this1.props.videoElement.currentTime)) {
8121
- return _this1.props.videoElement.currentTime;
8037
+ _this.getCurrentTime = function() {
8038
+ if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
8039
+ return _this.props.videoElement.currentTime;
8122
8040
  }
8123
8041
  return null;
8124
8042
  };
8125
- _this1.getSecondsLoaded = function() {
8126
- if (_this1.props.videoElement && _this1.props.videoElement.buffered.length > 0) {
8127
- return _this1.props.videoElement.buffered.end(_this1.props.videoElement.buffered.length - 1);
8043
+ _this.getSecondsLoaded = function() {
8044
+ if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
8045
+ return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
8128
8046
  }
8129
8047
  return null;
8130
8048
  };
8131
- _this1.getInternalPlayer = function() {
8049
+ _this.getInternalPlayer = function() {
8132
8050
  var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
8133
- if (key === "player") return _this1.player;
8134
- if (key === "video") return _this1.props.videoElement;
8135
- if (key === "hls" && _this1.player) return _this1.player.hls;
8051
+ if (key === "player") return _this.player;
8052
+ if (key === "video") return _this.props.videoElement;
8053
+ if (key === "hls" && _this.player) return _this.player.hls;
8136
8054
  return null;
8137
8055
  };
8138
8056
  return _this;