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