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
@@ -177,9 +177,17 @@ function _ts_generator(thisArg, body) {
177
177
  },
178
178
  trys: [],
179
179
  ops: []
180
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
181
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
182
- return this;
180
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
181
+ return d(g, "next", {
182
+ value: verb(0)
183
+ }), d(g, "throw", {
184
+ value: verb(1)
185
+ }), d(g, "return", {
186
+ value: verb(2)
187
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
188
+ value: function() {
189
+ return this;
190
+ }
183
191
  }), g;
184
192
  function verb(n) {
185
193
  return function(v) {
@@ -279,20 +287,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
279
287
  var __getOwnPropNames = Object.getOwnPropertyNames;
280
288
  var __getProtoOf = Object.getPrototypeOf;
281
289
  var __hasOwnProp = Object.prototype.hasOwnProperty;
282
- var __export = function(target, all) {
290
+ var __export = function __export(target, all) {
283
291
  for(var name in all)__defProp(target, name, {
284
292
  get: all[name],
285
293
  enumerable: true
286
294
  });
287
295
  };
288
- var __copyProps = function(to, from, except, desc) {
296
+ var __copyProps = function __copyProps(to, from, except, desc) {
289
297
  if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
290
298
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
291
299
  try {
292
300
  var _loop = function() {
293
301
  var key = _step.value;
294
302
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
295
- get: function() {
303
+ get: function get() {
296
304
  return from[key];
297
305
  },
298
306
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -316,7 +324,7 @@ var __copyProps = function(to, from, except, desc) {
316
324
  }
317
325
  return to;
318
326
  };
319
- var __toESM = function(mod, isNodeMode, target) {
327
+ var __toESM = function __toESM(mod, isNodeMode, target) {
320
328
  return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
321
329
  // file that has been converted to a CommonJS file using a Babel-
322
330
  // compatible transform (i.e. "__esModule" has not been set), then set
@@ -326,7 +334,7 @@ var __toESM = function(mod, isNodeMode, target) {
326
334
  enumerable: true
327
335
  }) : target, mod);
328
336
  };
329
- var __toCommonJS = function(mod) {
337
+ var __toCommonJS = function __toCommonJS(mod) {
330
338
  return __copyProps(__defProp({}, "__esModule", {
331
339
  value: true
332
340
  }), mod);
@@ -334,7 +342,7 @@ var __toCommonJS = function(mod) {
334
342
  // src/player/StormcloudVideoPlayer.ts
335
343
  var StormcloudVideoPlayer_exports = {};
336
344
  __export(StormcloudVideoPlayer_exports, {
337
- StormcloudVideoPlayer: function() {
345
+ StormcloudVideoPlayer: function StormcloudVideoPlayer1() {
338
346
  return StormcloudVideoPlayer;
339
347
  }
340
348
  });
@@ -667,7 +675,7 @@ function createImaController(video, options) {
667
675
  var fn = _step.value;
668
676
  try {
669
677
  fn(payload);
670
- } catch (e) {}
678
+ } catch (unused) {}
671
679
  }
672
680
  } catch (err) {
673
681
  _didIteratorError = true;
@@ -705,7 +713,7 @@ function createImaController(video, options) {
705
713
  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'.");
706
714
  }
707
715
  }
708
- } catch (e) {}
716
+ } catch (unused) {}
709
717
  if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
710
718
  var existing = document.querySelector('script[data-ima="true"]');
711
719
  if (existing) {
@@ -953,7 +961,7 @@ function createImaController(video, options) {
953
961
  if (adsManager) {
954
962
  try {
955
963
  adsManager.destroy();
956
- } catch (e) {}
964
+ } catch (unused) {}
957
965
  adsManager = void 0;
958
966
  }
959
967
  if (adVideoElement) {
@@ -964,7 +972,7 @@ function createImaController(video, options) {
964
972
  if (adsLoader) {
965
973
  try {
966
974
  adsLoader.destroy();
967
- } catch (e) {}
975
+ } catch (unused) {}
968
976
  adsLoader = void 0;
969
977
  }
970
978
  }
@@ -982,7 +990,7 @@ function createImaController(video, options) {
982
990
  try {
983
991
  var _adDisplayContainer_initialize;
984
992
  (_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
985
- } catch (e) {}
993
+ } catch (unused) {}
986
994
  }
987
995
  }).catch(function() {});
988
996
  },
@@ -1141,7 +1149,7 @@ function createImaController(video, options) {
1141
1149
  window.setTimeout(function() {
1142
1150
  try {
1143
1151
  makeAdsRequest(google, lastAdTagUrl);
1144
- } catch (e) {}
1152
+ } catch (unused) {}
1145
1153
  }, delay);
1146
1154
  } else {
1147
1155
  emit("ad_error", {
@@ -1173,7 +1181,7 @@ function createImaController(video, options) {
1173
1181
  if (adsManager) {
1174
1182
  try {
1175
1183
  adsManager.setVolume(adVolume);
1176
- } catch (e) {}
1184
+ } catch (unused) {}
1177
1185
  }
1178
1186
  emit("content_pause");
1179
1187
  });
@@ -1187,7 +1195,7 @@ function createImaController(video, options) {
1187
1195
  if (adsManager) {
1188
1196
  try {
1189
1197
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1190
- } catch (e) {}
1198
+ } catch (unused) {}
1191
1199
  }
1192
1200
  }
1193
1201
  if (adContainerEl) {
@@ -1348,7 +1356,7 @@ function createImaController(video, options) {
1348
1356
  }
1349
1357
  try {
1350
1358
  adsManager.setVolume(originalMutedState ? 0 : adVolume);
1351
- } catch (e) {}
1359
+ } catch (unused) {}
1352
1360
  adsManager.start();
1353
1361
  return [
1354
1362
  2,
@@ -1430,7 +1438,7 @@ function createImaController(video, options) {
1430
1438
  try {
1431
1439
  ;
1432
1440
  adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
1433
- } catch (e) {}
1441
+ } catch (unused) {}
1434
1442
  destroyAdsManager();
1435
1443
  return [
1436
1444
  2
@@ -1461,7 +1469,7 @@ function createImaController(video, options) {
1461
1469
  try {
1462
1470
  var _adsLoader_destroy;
1463
1471
  adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
1464
- } catch (e) {}
1472
+ } catch (unused) {}
1465
1473
  adDisplayContainer = void 0;
1466
1474
  adsLoader = void 0;
1467
1475
  contentVideoHidden = false;
@@ -1510,7 +1518,7 @@ function createImaController(video, options) {
1510
1518
  if (adsManager && adPlaying) {
1511
1519
  try {
1512
1520
  adsManager.setVolume(clampedVolume);
1513
- } catch (e) {}
1521
+ } catch (unused) {}
1514
1522
  }
1515
1523
  },
1516
1524
  getAdVolume: function getAdVolume() {
@@ -2423,12 +2431,12 @@ function createHlsAdPlayer(contentVideo, options) {
2423
2431
  }
2424
2432
  // src/sdk/prebid.ts
2425
2433
  var DEFAULT_TIMEOUT_MS = 3e3;
2426
- var AUCTION_PATH = "/openrtb2/auction";
2427
- function createPrebidManager(config) {
2434
+ var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
2435
+ function createPrebidManager() {
2436
+ var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2437
+ var _options_debug;
2428
2438
  var initialized = false;
2429
- var serverUrl = "";
2430
- var _config_debug;
2431
- var debug = (_config_debug = config.debug) !== null && _config_debug !== void 0 ? _config_debug : false;
2439
+ var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
2432
2440
  function log() {
2433
2441
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2434
2442
  args[_key] = arguments[_key];
@@ -2449,49 +2457,6 @@ function createPrebidManager(config) {
2449
2457
  "[Prebid]"
2450
2458
  ].concat(_to_consumable_array(args)));
2451
2459
  }
2452
- function resolveServerUrl() {
2453
- var _config_ortbRequest_ext_prebid_server, _config_ortbRequest_ext_prebid, _config_ortbRequest_ext, _config_ortbRequest;
2454
- if (config.serverUrl) {
2455
- return config.serverUrl.replace(/\/$/, "");
2456
- }
2457
- 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;
2458
- if (typeof extUrl === "string" && extUrl.length > 0) {
2459
- return extUrl.replace(/\/$/, "");
2460
- }
2461
- throw new Error("Prebid Server URL not configured. Provide serverUrl in PrebidConfig or ext.prebid.server.externalurl in the OpenRTB request.");
2462
- }
2463
- function buildRequest() {
2464
- var req = JSON.parse(JSON.stringify(config.ortbRequest));
2465
- req.id = "".concat(req.id || "prebid", "-").concat(Date.now(), "-").concat(Math.random().toString(36).slice(2, 8));
2466
- if (!req.ext) req.ext = {};
2467
- if (!req.ext.prebid) req.ext.prebid = {};
2468
- if (!req.ext.prebid.cache) req.ext.prebid.cache = {};
2469
- if (!req.ext.prebid.cache.vastxml) req.ext.prebid.cache.vastxml = {};
2470
- if (!req.ext.prebid.targeting) {
2471
- req.ext.prebid.targeting = {
2472
- includewinners: true,
2473
- includebidderkeys: false
2474
- };
2475
- }
2476
- if (!req.device) req.device = {};
2477
- if (typeof navigator !== "undefined") {
2478
- if (!req.device.ua) req.device.ua = navigator.userAgent;
2479
- if (!req.device.language) {
2480
- req.device.language = (navigator.language || "").split("-")[0] || "en";
2481
- }
2482
- }
2483
- if (typeof window !== "undefined") {
2484
- var _window_screen, _window_screen1;
2485
- if (!req.device.w) req.device.w = ((_window_screen = window.screen) === null || _window_screen === void 0 ? void 0 : _window_screen.width) || window.innerWidth;
2486
- if (!req.device.h) req.device.h = ((_window_screen1 = window.screen) === null || _window_screen1 === void 0 ? void 0 : _window_screen1.height) || window.innerHeight;
2487
- }
2488
- if (!req.site) req.site = {};
2489
- if (typeof window !== "undefined") {
2490
- if (!req.site.page) req.site.page = window.location.href;
2491
- if (!req.site.domain) req.site.domain = window.location.hostname;
2492
- }
2493
- return req;
2494
- }
2495
2460
  function parseResponse(data) {
2496
2461
  var bids = [];
2497
2462
  var seatbids = (data === null || data === void 0 ? void 0 : data.seatbid) || [];
@@ -2561,12 +2526,6 @@ function createPrebidManager(config) {
2561
2526
  function extractVastUrl(bids) {
2562
2527
  if (bids.length === 0) return null;
2563
2528
  var winner = bids[0];
2564
- var _config_cpmFloor;
2565
- var cpmFloor = (_config_cpmFloor = config.cpmFloor) !== null && _config_cpmFloor !== void 0 ? _config_cpmFloor : 0;
2566
- if (cpmFloor > 0 && winner.cpm < cpmFloor) {
2567
- log("Winning bid $".concat(winner.cpm.toFixed(2), " below CPM floor $").concat(cpmFloor.toFixed(2), ", rejecting"));
2568
- return null;
2569
- }
2570
2529
  if (winner.vastUrl) {
2571
2530
  log("Using cached VAST URL from ".concat(winner.bidder, " ($").concat(winner.cpm.toFixed(2), " ").concat(winner.currency, ")"));
2572
2531
  return winner.vastUrl;
@@ -2588,22 +2547,12 @@ function createPrebidManager(config) {
2588
2547
  }
2589
2548
  function initialize() {
2590
2549
  return _async_to_generator(function() {
2591
- var _config_ortbRequest;
2592
2550
  return _ts_generator(this, function(_state) {
2593
2551
  if (initialized) return [
2594
2552
  2
2595
2553
  ];
2596
- serverUrl = resolveServerUrl();
2597
- if (!((_config_ortbRequest = config.ortbRequest) === null || _config_ortbRequest === void 0 ? void 0 : _config_ortbRequest.imp) || config.ortbRequest.imp.length === 0) {
2598
- throw new Error("No impressions (imp) defined in the OpenRTB request.");
2599
- }
2600
2554
  initialized = true;
2601
- log("Initialized with server:", serverUrl);
2602
- log("Bidders:", config.ortbRequest.imp.map(function(imp) {
2603
- var _imp_ext_prebid, _imp_ext;
2604
- 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;
2605
- return bidders ? Object.keys(bidders).join(", ") : "none";
2606
- }).join("; "));
2555
+ log("Initialized, auction URL:", AUCTION_URL);
2607
2556
  return [
2608
2557
  2
2609
2558
  ];
@@ -2612,17 +2561,15 @@ function createPrebidManager(config) {
2612
2561
  }
2613
2562
  function requestBids() {
2614
2563
  return _async_to_generator(function() {
2615
- 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;
2564
+ var timeout, controller, timeoutId, _data_ext, _data_ext1, fetchOptions, response, body, data, bids, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, b, error;
2616
2565
  return _ts_generator(this, function(_state) {
2617
2566
  switch(_state.label){
2618
2567
  case 0:
2619
2568
  if (!initialized) {
2620
2569
  throw new Error("Prebid not initialized. Call initialize() first.");
2621
2570
  }
2622
- auctionUrl = "".concat(serverUrl).concat(AUCTION_PATH);
2623
- request = buildRequest();
2624
- timeout = (_ref = (_config_timeout = config.timeout) !== null && _config_timeout !== void 0 ? _config_timeout : config.ortbRequest.tmax) !== null && _ref !== void 0 ? _ref : DEFAULT_TIMEOUT_MS;
2625
- log("Sending auction request to:", auctionUrl);
2571
+ timeout = DEFAULT_TIMEOUT_MS;
2572
+ log("Fetching auction response from:", AUCTION_URL);
2626
2573
  controller = typeof AbortController !== "undefined" ? new AbortController() : null;
2627
2574
  timeoutId = setTimeout(function() {
2628
2575
  controller === null || controller === void 0 ? void 0 : controller.abort();
@@ -2636,18 +2583,14 @@ function createPrebidManager(config) {
2636
2583
  7
2637
2584
  ]);
2638
2585
  fetchOptions = {
2639
- method: "POST",
2640
- headers: {
2641
- "Content-Type": "application/json"
2642
- },
2643
- body: JSON.stringify(request)
2586
+ method: "POST"
2644
2587
  };
2645
2588
  if (controller) {
2646
2589
  fetchOptions.signal = controller.signal;
2647
2590
  }
2648
2591
  return [
2649
2592
  4,
2650
- fetch(auctionUrl, fetchOptions)
2593
+ fetch(AUCTION_URL, fetchOptions)
2651
2594
  ];
2652
2595
  case 2:
2653
2596
  response = _state.sent();
@@ -2764,7 +2707,6 @@ function createPrebidManager(config) {
2764
2707
  }
2765
2708
  function destroy() {
2766
2709
  initialized = false;
2767
- serverUrl = "";
2768
2710
  log("Destroyed");
2769
2711
  }
2770
2712
  return {
@@ -2780,7 +2722,7 @@ function createPrebidManager(config) {
2780
2722
  // src/sdk/prebidController.ts
2781
2723
  var import_hls2 = __toESM(require("hls.js"), 1);
2782
2724
  var LOG = "[PrebidController]";
2783
- function createPrebidController(contentVideo, prebidConfig, options) {
2725
+ function createPrebidController(contentVideo, options) {
2784
2726
  var adPlaying = false;
2785
2727
  var originalMutedState = false;
2786
2728
  var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
@@ -2794,11 +2736,9 @@ function createPrebidController(contentVideo, prebidConfig, options) {
2794
2736
  var sessionId;
2795
2737
  var destroyed = false;
2796
2738
  var trackingFired = createEmptyTrackingState();
2797
- var _prebidConfig_debug;
2798
- var prebidDebug = (_prebidConfig_debug = prebidConfig.debug) !== null && _prebidConfig_debug !== void 0 ? _prebidConfig_debug : false;
2799
- var prebidManager = createPrebidManager(_object_spread_props(_object_spread({}, prebidConfig), {
2800
- debug: prebidDebug
2801
- }));
2739
+ var prebidManager = createPrebidManager((options === null || options === void 0 ? void 0 : options.debug) !== void 0 ? {
2740
+ debug: options.debug
2741
+ } : {});
2802
2742
  var prebidInitialized = false;
2803
2743
  function emit(event, payload) {
2804
2744
  var set = listeners.get(event);
@@ -2997,6 +2937,8 @@ function createPrebidController(contentVideo, prebidConfig, options) {
2997
2937
  adContainerEl.style.display = "none";
2998
2938
  adContainerEl.style.pointerEvents = "none";
2999
2939
  }
2940
+ contentVideo.style.visibility = "visible";
2941
+ contentVideo.style.opacity = "1";
3000
2942
  if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
3001
2943
  if (contentVideo.paused) {
3002
2944
  console.log("".concat(LOG, " Content video paused in live mode, resuming playback"));
@@ -3021,19 +2963,12 @@ function createPrebidController(contentVideo, prebidConfig, options) {
3021
2963
  }
3022
2964
  function ensurePrebidInitialized() {
3023
2965
  return _async_to_generator(function() {
3024
- var _prebidConfig_ortbRequest_imp, _prebidConfig_ortbRequest;
3025
2966
  return _ts_generator(this, function(_state) {
3026
2967
  switch(_state.label){
3027
2968
  case 0:
3028
2969
  if (prebidInitialized) return [
3029
2970
  2
3030
2971
  ];
3031
- if (prebidConfig.enabled === false) {
3032
- throw new Error("Prebid is disabled in config");
3033
- }
3034
- 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)) {
3035
- throw new Error("No impressions configured in ortbRequest");
3036
- }
3037
2972
  return [
3038
2973
  4,
3039
2974
  prebidManager.initialize()
@@ -3051,7 +2986,7 @@ function createPrebidController(contentVideo, prebidConfig, options) {
3051
2986
  }
3052
2987
  function runPrebidAuction() {
3053
2988
  return _async_to_generator(function() {
3054
- var bids, _prebidConfig_cpmFloor, cpmFloor, winner;
2989
+ var bids, winner;
3055
2990
  return _ts_generator(this, function(_state) {
3056
2991
  switch(_state.label){
3057
2992
  case 0:
@@ -3074,15 +3009,7 @@ function createPrebidController(contentVideo, prebidConfig, options) {
3074
3009
  null
3075
3010
  ];
3076
3011
  }
3077
- cpmFloor = (_prebidConfig_cpmFloor = prebidConfig.cpmFloor) !== null && _prebidConfig_cpmFloor !== void 0 ? _prebidConfig_cpmFloor : 0;
3078
3012
  winner = bids[0];
3079
- if (cpmFloor > 0 && winner.cpm < cpmFloor) {
3080
- console.log("".concat(LOG, " Winning bid $").concat(winner.cpm.toFixed(2), " below CPM floor $").concat(cpmFloor.toFixed(2), ", rejecting"));
3081
- return [
3082
- 2,
3083
- null
3084
- ];
3085
- }
3086
3013
  console.log("".concat(LOG, " Winning bid: ").concat(winner.bidder, " $").concat(winner.cpm.toFixed(2), " ").concat(winner.currency));
3087
3014
  if (winner.vastXml) {
3088
3015
  console.log("".concat(LOG, " Parsing VAST XML from bid response (inline)"));
@@ -4187,22 +4114,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4187
4114
  adPlayerType = "hls";
4188
4115
  }
4189
4116
  if (adPlayerType === "prebid") {
4190
- if (!this.config.prebid) {
4191
- console.warn("[StormcloudVideoPlayer] adPlayerType is 'prebid' but no prebid config provided, falling back to HLS ad player");
4192
- return createHlsAdPlayer(this.video, _object_spread({
4193
- continueLiveStreamDuringAds: continueLiveStreamDuringAds
4194
- }, this.config.licenseKey ? {
4195
- licenseKey: this.config.licenseKey
4196
- } : {}, this.hls ? {
4197
- mainHlsInstance: this.hls
4198
- } : {}));
4199
- }
4200
4117
  if (this.config.debugAdTiming) {
4201
4118
  console.log("[StormcloudVideoPlayer] Creating Prebid ad controller (standalone, no IMA SDK)");
4202
4119
  }
4203
- return createPrebidController(this.video, this.config.prebid, _object_spread({
4120
+ return createPrebidController(this.video, _object_spread({
4204
4121
  continueLiveStreamDuringAds: continueLiveStreamDuringAds
4205
- }, this.config.licenseKey ? {
4122
+ }, this.config.debugAdTiming !== void 0 ? {
4123
+ debug: this.config.debugAdTiming
4124
+ } : {}, this.config.licenseKey ? {
4206
4125
  licenseKey: this.config.licenseKey
4207
4126
  } : {}, this.hls ? {
4208
4127
  mainHlsInstance: this.hls
@@ -4328,7 +4247,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4328
4247
  });
4329
4248
  this.hls.on(import_hls3.default.Events.MANIFEST_PARSED, function(_, data) {
4330
4249
  return _async_to_generator(function() {
4331
- var _this_hls_levels, _this_hls, _this_hls_levels_some, adBehavior, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
4250
+ var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
4332
4251
  return _ts_generator(this, function(_state) {
4333
4252
  switch(_state.label){
4334
4253
  case 0:
@@ -4337,10 +4256,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4337
4256
  } else {
4338
4257
  ;
4339
4258
  ;
4340
- 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) {
4259
+ 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) {
4341
4260
  var _level_details, _level_details1;
4342
4261
  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";
4343
- })) !== null && _this_hls_levels_some !== void 0 ? _this_hls_levels_some : false;
4262
+ })) !== null && _ref !== void 0 ? _ref : false;
4344
4263
  }
4345
4264
  if (this.config.debugAdTiming) {
4346
4265
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -4404,9 +4323,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4404
4323
  var tag = "";
4405
4324
  var value = "";
4406
4325
  if (Array.isArray(entry)) {
4407
- var _entry_;
4326
+ var _entry_, _entry_1;
4408
4327
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4409
- var _entry_1;
4410
4328
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4411
4329
  } else if (typeof entry === "string") {
4412
4330
  var idx = entry.indexOf(":");
@@ -4529,9 +4447,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4529
4447
  var tag = "";
4530
4448
  var value = "";
4531
4449
  if (Array.isArray(entry)) {
4532
- var _entry_;
4450
+ var _entry_, _entry_1;
4533
4451
  tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
4534
- var _entry_1;
4535
4452
  value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
4536
4453
  } else if (typeof entry === "string") {
4537
4454
  var idx = entry.indexOf(":");
@@ -4581,10 +4498,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4581
4498
  }
4582
4499
  });
4583
4500
  } else if (tag.includes("EXT-X-DATERANGE")) {
4501
+ var _attrs_CLASS;
4584
4502
  var attrs = _this.parseAttributeList(value);
4585
4503
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4586
4504
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4587
- var _attrs_CLASS;
4588
4505
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4589
4506
  var duration = _this.toNumber(attrs["DURATION"]);
4590
4507
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -4986,11 +4903,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4986
4903
  }
4987
4904
  var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
4988
4905
  if (daterangeMatch) {
4989
- var _daterangeMatch_;
4906
+ var _daterangeMatch_, _attrs_CLASS;
4990
4907
  var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
4991
4908
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
4992
4909
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
4993
- var _attrs_CLASS;
4994
4910
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
4995
4911
  var duration = this.toNumber(attrs["DURATION"]);
4996
4912
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
@@ -5066,7 +4982,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5066
4982
  var out = "";
5067
4983
  for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
5068
4984
  return out;
5069
- } catch (e) {
4985
+ } catch (unused) {
5070
4986
  return void 0;
5071
4987
  }
5072
4988
  }
@@ -5085,6 +5001,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5085
5001
  });
5086
5002
  }
5087
5003
  if (marker.type === "start") {
5004
+ var _this_config_immediateManifestAds;
5088
5005
  var _this_pendingAdBreak;
5089
5006
  if (!this.video.muted) {
5090
5007
  this.video.muted = true;
@@ -5109,7 +5026,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5109
5026
  this.expectedAdBreakDurationMs = durationMs;
5110
5027
  this.currentAdBreakStartWallClockMs = Date.now();
5111
5028
  var isManifestMarker = this.isManifestBasedMarker(marker);
5112
- var _this_config_immediateManifestAds;
5113
5029
  var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
5114
5030
  if (this.config.debugAdTiming) {
5115
5031
  console.log("[StormcloudVideoPlayer] Ad start decision:", {
@@ -5264,9 +5180,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5264
5180
  var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
5265
5181
  var match;
5266
5182
  while((match = regex.exec(value)) !== null){
5267
- var _match_;
5183
+ var _match_, _ref, _match_1;
5268
5184
  var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
5269
- var _match_1, _ref;
5270
5185
  var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
5271
5186
  if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
5272
5187
  rawVal = rawVal.slice(1, -1);
@@ -5625,13 +5540,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5625
5540
  {
5626
5541
  key: "shouldShowNativeControls",
5627
5542
  value: function shouldShowNativeControls() {
5543
+ var _this_config_showCustomControls;
5628
5544
  var streamType = this.getStreamType();
5629
5545
  if (streamType === "other") {
5630
- var _this_config_showCustomControls;
5631
- return !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false);
5546
+ var _this_config_showCustomControls1;
5547
+ return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
5632
5548
  }
5633
- var _this_config_showCustomControls1;
5634
- return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
5549
+ return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
5635
5550
  }
5636
5551
  },
5637
5552
  {
@@ -5790,12 +5705,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5790
5705
  continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
5791
5706
  preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
5792
5707
  preloadIma.initialize();
5793
- errorListener = function(payload) {
5708
+ errorListener = function errorListener(payload) {
5794
5709
  hasAdError = true;
5795
5710
  adErrorPayload = payload;
5796
5711
  };
5797
5712
  preloadIma.on("ad_error", errorListener);
5798
- errorListenerCleanup = function() {
5713
+ errorListenerCleanup = function errorListenerCleanup() {
5799
5714
  return preloadIma.off("ad_error", errorListener);
5800
5715
  };
5801
5716
  return [
@@ -5846,7 +5761,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5846
5761
  isReady: true,
5847
5762
  loadPromise: Promise.resolve()
5848
5763
  };
5849
- lateErrorListener = function(payload) {
5764
+ lateErrorListener = function lateErrorListener(payload) {
5850
5765
  var index = _this.preloadPool.findIndex(function(entry) {
5851
5766
  return entry.vastUrl === vastUrl;
5852
5767
  });
@@ -5857,7 +5772,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5857
5772
  }
5858
5773
  try {
5859
5774
  preloadIma.destroy();
5860
- } catch (e) {}
5775
+ } catch (unused) {}
5861
5776
  }
5862
5777
  };
5863
5778
  preloadIma.on("ad_error", lateErrorListener);
@@ -6682,7 +6597,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6682
6597
  10
6683
6598
  ];
6684
6599
  nextAdUrl = this.adRequestQueue.shift();
6685
- if (!nextAdUrl) {
6600
+ if (nextAdUrl == null) {
6686
6601
  return [
6687
6602
  3,
6688
6603
  4
@@ -6868,7 +6783,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6868
6783
  9
6869
6784
  ];
6870
6785
  nextAdUrl = this.adRequestQueue.shift();
6871
- if (!nextAdUrl) {
6786
+ if (nextAdUrl == null) {
6872
6787
  return [
6873
6788
  3,
6874
6789
  3
@@ -7073,11 +6988,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7073
6988
  {
7074
6989
  key: "ensureAdStoppedByTimer",
7075
6990
  value: function ensureAdStoppedByTimer() {
6991
+ var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
7076
6992
  if (!this.inAdBreak) return;
7077
6993
  this.adStopTimerId = void 0;
7078
6994
  var adPlaying = this.ima.isAdPlaying();
7079
6995
  var pendingAds = this.adPodQueue.length > 0;
7080
- var _this_config_adBreakCheckIntervalMs;
7081
6996
  var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
7082
6997
  var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
7083
6998
  var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
@@ -7085,7 +7000,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7085
7000
  if (this.currentAdBreakStartWallClockMs != null) {
7086
7001
  elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
7087
7002
  }
7088
- var _this_expectedAdBreakDurationMs;
7089
7003
  var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
7090
7004
  var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
7091
7005
  var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
@@ -7342,15 +7256,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7342
7256
  9
7343
7257
  ];
7344
7258
  case 9:
7345
- if (this.isTemporaryAdError(playError)) {
7346
- this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7347
- if (this.config.debugAdTiming) {
7348
- console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
7349
- }
7350
- } else {
7351
- this.failedVastUrls.add(vastTagUrl);
7352
- if (this.config.debugAdTiming) {
7353
- console.log("[AD-ERROR] Permanent play error - URL blacklisted");
7259
+ if (vastTagUrl) {
7260
+ if (this.isTemporaryAdError(playError)) {
7261
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7262
+ if (this.config.debugAdTiming) {
7263
+ console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
7264
+ }
7265
+ } else {
7266
+ this.failedVastUrls.add(vastTagUrl);
7267
+ if (this.config.debugAdTiming) {
7268
+ console.log("[AD-ERROR] Permanent play error - URL blacklisted");
7269
+ }
7354
7270
  }
7355
7271
  }
7356
7272
  this.clearAdFailsafeTimer();
@@ -7419,15 +7335,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7419
7335
  15
7420
7336
  ];
7421
7337
  case 15:
7422
- if (this.isTemporaryAdError(error)) {
7423
- this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7424
- if (this.config.debugAdTiming) {
7425
- console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
7426
- }
7427
- } else {
7428
- this.failedVastUrls.add(vastTagUrl);
7429
- if (this.config.debugAdTiming) {
7430
- console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
7338
+ if (vastTagUrl) {
7339
+ if (this.isTemporaryAdError(error)) {
7340
+ this.temporaryFailureUrls.set(vastTagUrl, Date.now());
7341
+ if (this.config.debugAdTiming) {
7342
+ console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
7343
+ }
7344
+ } else {
7345
+ this.failedVastUrls.add(vastTagUrl);
7346
+ if (this.config.debugAdTiming) {
7347
+ console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
7348
+ }
7431
7349
  }
7432
7350
  }
7433
7351
  this.clearAdRequestWatchdog();
@@ -7530,8 +7448,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7530
7448
  key: "startAdRequestWatchdog",
7531
7449
  value: function startAdRequestWatchdog(token) {
7532
7450
  var _this = this;
7533
- this.clearAdRequestWatchdog();
7534
7451
  var _this_config_adFailsafeTimeoutMs;
7452
+ this.clearAdRequestWatchdog();
7535
7453
  var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7536
7454
  this.adRequestWatchdogToken = token;
7537
7455
  this.adRequestWatchdogId = window.setTimeout(function() {
@@ -7574,8 +7492,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7574
7492
  key: "startAdFailsafeTimer",
7575
7493
  value: function startAdFailsafeTimer(token) {
7576
7494
  var _this = this;
7577
- this.clearAdFailsafeTimer();
7578
7495
  var _this_config_adFailsafeTimeoutMs;
7496
+ this.clearAdFailsafeTimer();
7579
7497
  var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
7580
7498
  this.adFailsafeToken = token;
7581
7499
  this.adFailsafeTimerId = window.setTimeout(function() {