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.
@@ -19,7 +19,7 @@ declare class StormcloudVideoPlayer {
19
19
  private readonly adBreak;
20
20
  private readonly floorLadder;
21
21
  private floorLadderEnabled;
22
- private readonly edgePodBaseUrl;
22
+ private edgePodBaseUrl;
23
23
  constructor(config: StormcloudVideoPlayerConfig);
24
24
  private get debug();
25
25
  private createAdPlayer;
@@ -27,6 +27,11 @@ declare class StormcloudVideoPlayer {
27
27
  setAdFloorLadder(update: Partial<AdFloorLadderConfig>): FloorLadderValidationReport;
28
28
  setAdFloorLadderEnabled(enabled: boolean): void;
29
29
  isAdFloorLadderEnabled(): boolean;
30
+ setEdgePodRequest(update: {
31
+ enableEdgePodRequest?: boolean;
32
+ edgePodUrl?: string;
33
+ }): void;
34
+ getEdgePodUrl(): string | undefined;
30
35
  private warnOnInvalidFloorLadder;
31
36
  getAdFloorLadder(): AdFloorLadderConfig;
32
37
  getAdFloorBounds(): FloorLadderBounds;
@@ -9257,19 +9257,31 @@ var HlsEngine = /*#__PURE__*/ function() {
9257
9257
  // src/player/EdgePodRequest.ts
9258
9258
  var EDGE_POD_MAX_ADS = 10;
9259
9259
  var EDGE_POD_EXCEEDS_BUDGET = "edge_pod_exceeds_budget";
9260
+ var LICENSE_KEY_PLACEHOLDER = /\{licenseKey\}|%7BlicenseKey%7D/gi;
9260
9261
  function resolveEdgePodBaseUrl(config) {
9261
- var _config_edgePodUrl;
9262
+ var _config_edgePodUrl, _config_licenseKey;
9262
9263
  if (config.enableEdgePodRequest !== true) return void 0;
9263
9264
  var raw = (_config_edgePodUrl = config.edgePodUrl) === null || _config_edgePodUrl === void 0 ? void 0 : _config_edgePodUrl.trim();
9264
9265
  if (!raw) {
9265
9266
  console.warn("[AdBreak][EDGE] enableEdgePodRequest is true but edgePodUrl is missing; using GAM only");
9266
9267
  return void 0;
9267
9268
  }
9269
+ var licenseKey = (_config_licenseKey = config.licenseKey) === null || _config_licenseKey === void 0 ? void 0 : _config_licenseKey.trim();
9270
+ if (!licenseKey) {
9271
+ console.warn("[AdBreak][EDGE] enableEdgePodRequest is true but licenseKey is missing; using GAM only");
9272
+ return void 0;
9273
+ }
9274
+ var encodedKey = encodeURIComponent(licenseKey);
9268
9275
  try {
9269
- var url = new URL(raw);
9276
+ var hasPlaceholder = raw.search(LICENSE_KEY_PLACEHOLDER) !== -1;
9277
+ var url = new URL(hasPlaceholder ? raw.replace(LICENSE_KEY_PLACEHOLDER, encodedKey) : raw);
9270
9278
  if (url.protocol !== "https:" && url.protocol !== "http:") {
9271
9279
  throw new Error("unsupported protocol ".concat(url.protocol));
9272
9280
  }
9281
+ if (!hasPlaceholder) {
9282
+ var path = url.pathname.replace(/\/+$/, "");
9283
+ url.pathname = /\/[^/]+\/pod$/.test(path) ? path.replace(/\/[^/]+\/pod$/, "/".concat(encodedKey, "/pod")) : "".concat(path, "/").concat(encodedKey, "/pod");
9284
+ }
9273
9285
  return url.toString();
9274
9286
  } catch (unused) {
9275
9287
  console.warn("[AdBreak][EDGE] edgePodUrl is not a valid http(s) URL; using GAM only");
@@ -11747,6 +11759,25 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
11747
11759
  return this.floorLadderEnabled;
11748
11760
  }
11749
11761
  },
11762
+ {
11763
+ key: "setEdgePodRequest",
11764
+ value: function setEdgePodRequest(update) {
11765
+ if (update.enableEdgePodRequest === this.config.enableEdgePodRequest && update.edgePodUrl === this.config.edgePodUrl) {
11766
+ return;
11767
+ }
11768
+ if (update.enableEdgePodRequest === void 0) delete this.config.enableEdgePodRequest;
11769
+ else this.config.enableEdgePodRequest = update.enableEdgePodRequest;
11770
+ if (update.edgePodUrl === void 0) delete this.config.edgePodUrl;
11771
+ else this.config.edgePodUrl = update.edgePodUrl;
11772
+ this.edgePodBaseUrl = resolveEdgePodBaseUrl(this.config);
11773
+ }
11774
+ },
11775
+ {
11776
+ key: "getEdgePodUrl",
11777
+ value: function getEdgePodUrl() {
11778
+ return this.edgePodBaseUrl;
11779
+ }
11780
+ },
11750
11781
  {
11751
11782
  key: "warnOnInvalidFloorLadder",
11752
11783
  value: function warnOnInvalidFloorLadder(report) {