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.
@@ -6483,6 +6483,10 @@ function toNumber(val) {
6483
6483
  var n = typeof val === "string" ? parseFloat(val) : Number(val);
6484
6484
  return Number.isNaN(n) ? void 0 : n;
6485
6485
  }
6486
+ function getDateRangeDurationSeconds(attrs) {
6487
+ var _toNumber;
6488
+ return (_toNumber = toNumber(attrs["DURATION"])) !== null && _toNumber !== void 0 ? _toNumber : toNumber(attrs["PLANNED-DURATION"]);
6489
+ }
6486
6490
  function isManifestBasedMarker(marker) {
6487
6491
  var raw = marker.raw;
6488
6492
  if (!raw) return false;
@@ -8848,11 +8852,13 @@ var HlsEngine = /*#__PURE__*/ function() {
8848
8852
  }
8849
8853
  }
8850
8854
  if (!tag) continue;
8855
+ if (tag.includes("EXT-X-CUE-OUT-CONT")) continue;
8851
8856
  if (tag.includes("EXT-X-CUE-OUT") || tag.includes("EXT-X-DATERANGE")) {
8852
- var attrs = tag.includes("EXT-X-DATERANGE") ? parseAttributeList(value) : {};
8857
+ var isDateRange = tag.includes("EXT-X-DATERANGE");
8858
+ var attrs = isDateRange ? parseAttributeList(value) : {};
8853
8859
  var hasScteOut = tag.includes("EXT-X-CUE-OUT") || "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
8854
8860
  if (hasScteOut) {
8855
- var durationSeconds = parseCueOutDuration(value);
8861
+ var durationSeconds = isDateRange ? getDateRangeDurationSeconds(attrs) : parseCueOutDuration(value);
8856
8862
  var marker = _object_spread_props(_object_spread({
8857
8863
  type: "start"
8858
8864
  }, durationSeconds !== void 0 ? {
@@ -9026,7 +9032,7 @@ var HlsEngine = /*#__PURE__*/ function() {
9026
9032
  var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
9027
9033
  var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
9028
9034
  var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
9029
- var duration = toNumber(attrs["DURATION"]);
9035
+ var duration = getDateRangeDurationSeconds(attrs);
9030
9036
  if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
9031
9037
  var marker2 = _object_spread_props(_object_spread({
9032
9038
  type: "start"
@@ -9293,19 +9299,31 @@ var HlsEngine = /*#__PURE__*/ function() {
9293
9299
  // src/player/EdgePodRequest.ts
9294
9300
  var EDGE_POD_MAX_ADS = 10;
9295
9301
  var EDGE_POD_EXCEEDS_BUDGET = "edge_pod_exceeds_budget";
9302
+ var LICENSE_KEY_PLACEHOLDER = /\{licenseKey\}|%7BlicenseKey%7D/gi;
9296
9303
  function resolveEdgePodBaseUrl(config) {
9297
- var _config_edgePodUrl;
9304
+ var _config_edgePodUrl, _config_licenseKey;
9298
9305
  if (config.enableEdgePodRequest !== true) return void 0;
9299
9306
  var raw = (_config_edgePodUrl = config.edgePodUrl) === null || _config_edgePodUrl === void 0 ? void 0 : _config_edgePodUrl.trim();
9300
9307
  if (!raw) {
9301
9308
  console.warn("[AdBreak][EDGE] enableEdgePodRequest is true but edgePodUrl is missing; using GAM only");
9302
9309
  return void 0;
9303
9310
  }
9311
+ var licenseKey = (_config_licenseKey = config.licenseKey) === null || _config_licenseKey === void 0 ? void 0 : _config_licenseKey.trim();
9312
+ if (!licenseKey) {
9313
+ console.warn("[AdBreak][EDGE] enableEdgePodRequest is true but licenseKey is missing; using GAM only");
9314
+ return void 0;
9315
+ }
9316
+ var encodedKey = encodeURIComponent(licenseKey);
9304
9317
  try {
9305
- var url = new URL(raw);
9318
+ var hasPlaceholder = raw.search(LICENSE_KEY_PLACEHOLDER) !== -1;
9319
+ var url = new URL(hasPlaceholder ? raw.replace(LICENSE_KEY_PLACEHOLDER, encodedKey) : raw);
9306
9320
  if (url.protocol !== "https:" && url.protocol !== "http:") {
9307
9321
  throw new Error("unsupported protocol ".concat(url.protocol));
9308
9322
  }
9323
+ if (!hasPlaceholder) {
9324
+ var path = url.pathname.replace(/\/+$/, "");
9325
+ url.pathname = /\/[^/]+\/pod$/.test(path) ? path.replace(/\/[^/]+\/pod$/, "/".concat(encodedKey, "/pod")) : "".concat(path, "/").concat(encodedKey, "/pod");
9326
+ }
9309
9327
  return url.toString();
9310
9328
  } catch (unused) {
9311
9329
  console.warn("[AdBreak][EDGE] edgePodUrl is not a valid http(s) URL; using GAM only");
@@ -11783,6 +11801,25 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
11783
11801
  return this.floorLadderEnabled;
11784
11802
  }
11785
11803
  },
11804
+ {
11805
+ key: "setEdgePodRequest",
11806
+ value: function setEdgePodRequest(update) {
11807
+ if (update.enableEdgePodRequest === this.config.enableEdgePodRequest && update.edgePodUrl === this.config.edgePodUrl) {
11808
+ return;
11809
+ }
11810
+ if (update.enableEdgePodRequest === void 0) delete this.config.enableEdgePodRequest;
11811
+ else this.config.enableEdgePodRequest = update.enableEdgePodRequest;
11812
+ if (update.edgePodUrl === void 0) delete this.config.edgePodUrl;
11813
+ else this.config.edgePodUrl = update.edgePodUrl;
11814
+ this.edgePodBaseUrl = resolveEdgePodBaseUrl(this.config);
11815
+ }
11816
+ },
11817
+ {
11818
+ key: "getEdgePodUrl",
11819
+ value: function getEdgePodUrl() {
11820
+ return this.edgePodBaseUrl;
11821
+ }
11822
+ },
11786
11823
  {
11787
11824
  key: "warnOnInvalidFloorLadder",
11788
11825
  value: function warnOnInvalidFloorLadder(report) {