stormcloud-video-player 0.8.70 → 0.8.71

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.
@@ -9260,19 +9260,31 @@ var HlsEngine = /*#__PURE__*/ function() {
9260
9260
  // src/player/EdgePodRequest.ts
9261
9261
  var EDGE_POD_MAX_ADS = 10;
9262
9262
  var EDGE_POD_EXCEEDS_BUDGET = "edge_pod_exceeds_budget";
9263
+ var LICENSE_KEY_PLACEHOLDER = /\{licenseKey\}|%7BlicenseKey%7D/gi;
9263
9264
  function resolveEdgePodBaseUrl(config) {
9264
- var _config_edgePodUrl;
9265
+ var _config_edgePodUrl, _config_licenseKey;
9265
9266
  if (config.enableEdgePodRequest !== true) return void 0;
9266
9267
  var raw = (_config_edgePodUrl = config.edgePodUrl) === null || _config_edgePodUrl === void 0 ? void 0 : _config_edgePodUrl.trim();
9267
9268
  if (!raw) {
9268
9269
  console.warn("[AdBreak][EDGE] enableEdgePodRequest is true but edgePodUrl is missing; using GAM only");
9269
9270
  return void 0;
9270
9271
  }
9272
+ var licenseKey = (_config_licenseKey = config.licenseKey) === null || _config_licenseKey === void 0 ? void 0 : _config_licenseKey.trim();
9273
+ if (!licenseKey) {
9274
+ console.warn("[AdBreak][EDGE] enableEdgePodRequest is true but licenseKey is missing; using GAM only");
9275
+ return void 0;
9276
+ }
9277
+ var encodedKey = encodeURIComponent(licenseKey);
9271
9278
  try {
9272
- var url = new URL(raw);
9279
+ var hasPlaceholder = raw.search(LICENSE_KEY_PLACEHOLDER) !== -1;
9280
+ var url = new URL(hasPlaceholder ? raw.replace(LICENSE_KEY_PLACEHOLDER, encodedKey) : raw);
9273
9281
  if (url.protocol !== "https:" && url.protocol !== "http:") {
9274
9282
  throw new Error("unsupported protocol ".concat(url.protocol));
9275
9283
  }
9284
+ if (!hasPlaceholder) {
9285
+ var path = url.pathname.replace(/\/+$/, "");
9286
+ url.pathname = /\/[^/]+\/pod$/.test(path) ? path.replace(/\/[^/]+\/pod$/, "/".concat(encodedKey, "/pod")) : "".concat(path, "/").concat(encodedKey, "/pod");
9287
+ }
9276
9288
  return url.toString();
9277
9289
  } catch (unused) {
9278
9290
  console.warn("[AdBreak][EDGE] edgePodUrl is not a valid http(s) URL; using GAM only");
@@ -11750,6 +11762,25 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
11750
11762
  return this.floorLadderEnabled;
11751
11763
  }
11752
11764
  },
11765
+ {
11766
+ key: "setEdgePodRequest",
11767
+ value: function setEdgePodRequest(update) {
11768
+ if (update.enableEdgePodRequest === this.config.enableEdgePodRequest && update.edgePodUrl === this.config.edgePodUrl) {
11769
+ return;
11770
+ }
11771
+ if (update.enableEdgePodRequest === void 0) delete this.config.enableEdgePodRequest;
11772
+ else this.config.enableEdgePodRequest = update.enableEdgePodRequest;
11773
+ if (update.edgePodUrl === void 0) delete this.config.edgePodUrl;
11774
+ else this.config.edgePodUrl = update.edgePodUrl;
11775
+ this.edgePodBaseUrl = resolveEdgePodBaseUrl(this.config);
11776
+ }
11777
+ },
11778
+ {
11779
+ key: "getEdgePodUrl",
11780
+ value: function getEdgePodUrl() {
11781
+ return this.edgePodBaseUrl;
11782
+ }
11783
+ },
11753
11784
  {
11754
11785
  key: "warnOnInvalidFloorLadder",
11755
11786
  value: function warnOnInvalidFloorLadder(report) {