stormcloud-video-player 0.8.70 → 0.8.72

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;
@@ -6447,6 +6447,10 @@ function toNumber(val) {
6447
6447
  var n = typeof val === "string" ? parseFloat(val) : Number(val);
6448
6448
  return Number.isNaN(n) ? void 0 : n;
6449
6449
  }
6450
+ function getDateRangeDurationSeconds(attrs) {
6451
+ var _toNumber;
6452
+ return (_toNumber = toNumber(attrs["DURATION"])) !== null && _toNumber !== void 0 ? _toNumber : toNumber(attrs["PLANNED-DURATION"]);
6453
+ }
6450
6454
  function isManifestBasedMarker(marker) {
6451
6455
  var raw = marker.raw;
6452
6456
  if (!raw) return false;
@@ -8812,11 +8816,13 @@ var HlsEngine = /*#__PURE__*/ function() {
8812
8816
  }
8813
8817
  }
8814
8818
  if (!tag) continue;
8819
+ if (tag.includes("EXT-X-CUE-OUT-CONT")) continue;
8815
8820
  if (tag.includes("EXT-X-CUE-OUT") || tag.includes("EXT-X-DATERANGE")) {
8816
- var attrs = tag.includes("EXT-X-DATERANGE") ? parseAttributeList(value) : {};
8821
+ var isDateRange = tag.includes("EXT-X-DATERANGE");
8822
+ var attrs = isDateRange ? parseAttributeList(value) : {};
8817
8823
  var hasScteOut = tag.includes("EXT-X-CUE-OUT") || "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
8818
8824
  if (hasScteOut) {
8819
- var durationSeconds = parseCueOutDuration(value);
8825
+ var durationSeconds = isDateRange ? getDateRangeDurationSeconds(attrs) : parseCueOutDuration(value);
8820
8826
  var marker = _object_spread_props(_object_spread({
8821
8827
  type: "start"
8822
8828
  }, durationSeconds !== void 0 ? {
@@ -8990,7 +8996,7 @@ var HlsEngine = /*#__PURE__*/ function() {
8990
8996
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
8991
8997
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
8992
8998
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
8993
- var duration = toNumber(attrs["DURATION"]);
8999
+ var duration = getDateRangeDurationSeconds(attrs);
8994
9000
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
8995
9001
  var marker2 = _object_spread_props(_object_spread({
8996
9002
  type: "start"
@@ -9257,19 +9263,31 @@ var HlsEngine = /*#__PURE__*/ function() {
9257
9263
  // src/player/EdgePodRequest.ts
9258
9264
  var EDGE_POD_MAX_ADS = 10;
9259
9265
  var EDGE_POD_EXCEEDS_BUDGET = "edge_pod_exceeds_budget";
9266
+ var LICENSE_KEY_PLACEHOLDER = /\{licenseKey\}|%7BlicenseKey%7D/gi;
9260
9267
  function resolveEdgePodBaseUrl(config) {
9261
- var _config_edgePodUrl;
9268
+ var _config_edgePodUrl, _config_licenseKey;
9262
9269
  if (config.enableEdgePodRequest !== true) return void 0;
9263
9270
  var raw = (_config_edgePodUrl = config.edgePodUrl) === null || _config_edgePodUrl === void 0 ? void 0 : _config_edgePodUrl.trim();
9264
9271
  if (!raw) {
9265
9272
  console.warn("[AdBreak][EDGE] enableEdgePodRequest is true but edgePodUrl is missing; using GAM only");
9266
9273
  return void 0;
9267
9274
  }
9275
+ var licenseKey = (_config_licenseKey = config.licenseKey) === null || _config_licenseKey === void 0 ? void 0 : _config_licenseKey.trim();
9276
+ if (!licenseKey) {
9277
+ console.warn("[AdBreak][EDGE] enableEdgePodRequest is true but licenseKey is missing; using GAM only");
9278
+ return void 0;
9279
+ }
9280
+ var encodedKey = encodeURIComponent(licenseKey);
9268
9281
  try {
9269
- var url = new URL(raw);
9282
+ var hasPlaceholder = raw.search(LICENSE_KEY_PLACEHOLDER) !== -1;
9283
+ var url = new URL(hasPlaceholder ? raw.replace(LICENSE_KEY_PLACEHOLDER, encodedKey) : raw);
9270
9284
  if (url.protocol !== "https:" && url.protocol !== "http:") {
9271
9285
  throw new Error("unsupported protocol ".concat(url.protocol));
9272
9286
  }
9287
+ if (!hasPlaceholder) {
9288
+ var path = url.pathname.replace(/\/+$/, "");
9289
+ url.pathname = /\/[^/]+\/pod$/.test(path) ? path.replace(/\/[^/]+\/pod$/, "/".concat(encodedKey, "/pod")) : "".concat(path, "/").concat(encodedKey, "/pod");
9290
+ }
9273
9291
  return url.toString();
9274
9292
  } catch (unused) {
9275
9293
  console.warn("[AdBreak][EDGE] edgePodUrl is not a valid http(s) URL; using GAM only");
@@ -11747,6 +11765,25 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
11747
11765
  return this.floorLadderEnabled;
11748
11766
  }
11749
11767
  },
11768
+ {
11769
+ key: "setEdgePodRequest",
11770
+ value: function setEdgePodRequest(update) {
11771
+ if (update.enableEdgePodRequest === this.config.enableEdgePodRequest && update.edgePodUrl === this.config.edgePodUrl) {
11772
+ return;
11773
+ }
11774
+ if (update.enableEdgePodRequest === void 0) delete this.config.enableEdgePodRequest;
11775
+ else this.config.enableEdgePodRequest = update.enableEdgePodRequest;
11776
+ if (update.edgePodUrl === void 0) delete this.config.edgePodUrl;
11777
+ else this.config.edgePodUrl = update.edgePodUrl;
11778
+ this.edgePodBaseUrl = resolveEdgePodBaseUrl(this.config);
11779
+ }
11780
+ },
11781
+ {
11782
+ key: "getEdgePodUrl",
11783
+ value: function getEdgePodUrl() {
11784
+ return this.edgePodBaseUrl;
11785
+ }
11786
+ },
11750
11787
  {
11751
11788
  key: "warnOnInvalidFloorLadder",
11752
11789
  value: function warnOnInvalidFloorLadder(report) {