stormcloud-video-player 0.7.29 → 0.7.31

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.
package/lib/index.cjs CHANGED
@@ -5956,10 +5956,10 @@ function TextOverlay(param) {
5956
5956
  });
5957
5957
  }
5958
5958
  function parseRSSXml(xmlText, maxItems) {
5959
+ var stripped = xmlText.replace(/^<\?xml[^?]*\?>\s*/, "");
5959
5960
  var parser = new DOMParser();
5960
- var doc = parser.parseFromString(xmlText, "text/xml");
5961
- if (doc.querySelector("parsererror")) throw new Error("Invalid RSS XML");
5962
- return Array.from(doc.querySelectorAll("item")).map(function(item) {
5961
+ var doc = parser.parseFromString(stripped, "text/xml");
5962
+ var items = Array.from(doc.querySelectorAll("item")).map(function(item) {
5963
5963
  var _item_querySelector, _item_querySelector1, _item_querySelector2, _item_querySelector3, _item_querySelector4;
5964
5964
  return {
5965
5965
  title: (((_item_querySelector = item.querySelector("title")) === null || _item_querySelector === void 0 ? void 0 : _item_querySelector.textContent) || "").replace(/<[^>]*>/g, "").trim(),
@@ -5971,6 +5971,26 @@ function parseRSSXml(xmlText, maxItems) {
5971
5971
  }).filter(function(i) {
5972
5972
  return i.title;
5973
5973
  }).slice(0, maxItems);
5974
+ if (items.length === 0 && doc.querySelector("parsererror")) {
5975
+ throw new Error("Invalid RSS XML");
5976
+ }
5977
+ return items;
5978
+ }
5979
+ var RSS_CACHE_TTL_MS = 6e4;
5980
+ var rssCache = /* @__PURE__ */ new Map();
5981
+ function cachedFetchRSSItems(rssUrl, maxItems) {
5982
+ var now = Date.now();
5983
+ var cached = rssCache.get(rssUrl);
5984
+ if (cached && cached.expiresAt > now) return cached.promise;
5985
+ var promise = fetchRSSItems(rssUrl, maxItems).catch(function(err) {
5986
+ rssCache.delete(rssUrl);
5987
+ throw err;
5988
+ });
5989
+ rssCache.set(rssUrl, {
5990
+ promise: promise,
5991
+ expiresAt: now + RSS_CACHE_TTL_MS
5992
+ });
5993
+ return promise;
5974
5994
  }
5975
5995
  function fetchRSSItems(rssUrl, maxItems) {
5976
5996
  return _async_to_generator(function() {
@@ -6124,7 +6144,7 @@ function ScrollerOverlay(param) {
6124
6144
  var cancelled = false;
6125
6145
  setRssLoading(true);
6126
6146
  setRssError(false);
6127
- fetchRSSItems(rssUrl, maxItems).then(function(items) {
6147
+ cachedFetchRSSItems(rssUrl, maxItems).then(function(items) {
6128
6148
  if (!cancelled) {
6129
6149
  setRssItems(items);
6130
6150
  setRssError(false);
@@ -6146,7 +6166,8 @@ function ScrollerOverlay(param) {
6146
6166
  (0, import_react.useEffect)(function() {
6147
6167
  if (!rssUrl || !autoRefresh || (cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text) && (cfg === null || cfg === void 0 ? void 0 : cfg.custom_text)) return;
6148
6168
  var interval = setInterval(function() {
6149
- fetchRSSItems(rssUrl, maxItems).then(function(items) {
6169
+ rssCache.delete(rssUrl);
6170
+ cachedFetchRSSItems(rssUrl, maxItems).then(function(items) {
6150
6171
  setRssItems(items);
6151
6172
  setRssError(false);
6152
6173
  }).catch(function() {});
@@ -6688,25 +6709,29 @@ function ComingUpNextOverlay(param) {
6688
6709
  var overlay = param.overlay, size = param.size;
6689
6710
  var cfg = parseConfig(overlay.content);
6690
6711
  if (!cfg) return null;
6691
- var f = Math.max(6, size.w * 0.05);
6712
+ var f = Math.max(9, Math.min(size.h * 0.19, size.w * 0.075));
6713
+ var showSubtitle = size.h >= 68;
6714
+ var showThumbnail = !!(cfg.thumbnailUrl && size.h >= 58);
6715
+ var thumbW = showThumbnail ? Math.max(40, size.h * 0.7) : 0;
6692
6716
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
6693
6717
  style: {
6694
6718
  width: "100%",
6695
6719
  height: "100%",
6696
- borderRadius: Math.max(2, size.w * 0.035),
6720
+ borderRadius: Math.max(2, size.w * 0.025),
6697
6721
  display: "flex",
6698
6722
  background: cfg.backgroundColor,
6699
6723
  color: cfg.textColor,
6700
- fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6724
+ fontFamily: "'Arial', 'Helvetica Neue', Helvetica, sans-serif",
6701
6725
  overflow: "hidden",
6702
6726
  pointerEvents: "none",
6703
6727
  userSelect: "none",
6704
- fontSize: "".concat(f, "px")
6728
+ fontSize: "".concat(f, "px"),
6729
+ WebkitFontSmoothing: "antialiased"
6705
6730
  },
6706
6731
  children: [
6707
6732
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6708
6733
  style: {
6709
- width: Math.max(2, size.w * 0.015),
6734
+ width: Math.max(3, size.w * 0.018),
6710
6735
  flexShrink: 0,
6711
6736
  backgroundColor: cfg.accentColor
6712
6737
  }
@@ -6717,36 +6742,38 @@ function ComingUpNextOverlay(param) {
6717
6742
  display: "flex",
6718
6743
  flexDirection: "column",
6719
6744
  justifyContent: "center",
6720
- padding: "".concat(f * 0.6, "px ").concat(f * 1, "px"),
6721
- minWidth: 0
6745
+ padding: "".concat(f * 0.35, "px ").concat(f * 0.75, "px"),
6746
+ minWidth: 0,
6747
+ gap: "".concat(f * 0.08, "px")
6722
6748
  },
6723
6749
  children: [
6724
6750
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6725
6751
  style: {
6726
- fontSize: "0.8em",
6727
- fontWeight: 600,
6752
+ fontSize: "0.7em",
6753
+ fontWeight: 700,
6728
6754
  textTransform: "uppercase",
6729
- letterSpacing: "0.05em",
6730
- color: cfg.accentColor
6755
+ letterSpacing: "0.09em",
6756
+ color: cfg.accentColor,
6757
+ lineHeight: 1
6731
6758
  },
6732
6759
  children: "Coming Up Next"
6733
6760
  }),
6734
6761
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6735
6762
  style: {
6736
- fontSize: "1.5em",
6763
+ fontSize: "1.35em",
6737
6764
  fontWeight: 700,
6738
- lineHeight: 1.2,
6739
- marginTop: f * 0.2,
6765
+ lineHeight: 1.15,
6740
6766
  overflow: "hidden",
6741
6767
  textOverflow: "ellipsis",
6742
6768
  whiteSpace: "nowrap"
6743
6769
  },
6744
6770
  children: cfg.title
6745
6771
  }),
6746
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6772
+ showSubtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6747
6773
  style: {
6748
- fontSize: "0.9em",
6749
- opacity: 0.6,
6774
+ fontSize: "0.82em",
6775
+ opacity: 0.65,
6776
+ lineHeight: 1.1,
6750
6777
  overflow: "hidden",
6751
6778
  textOverflow: "ellipsis",
6752
6779
  whiteSpace: "nowrap"
@@ -6755,24 +6782,24 @@ function ComingUpNextOverlay(param) {
6755
6782
  }),
6756
6783
  cfg.scheduledTime && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6757
6784
  style: {
6758
- fontSize: "1em",
6759
- fontWeight: 600,
6760
- marginTop: f * 0.4,
6761
- color: cfg.accentColor
6785
+ fontSize: "0.9em",
6786
+ fontWeight: 700,
6787
+ color: cfg.accentColor,
6788
+ lineHeight: 1
6762
6789
  },
6763
6790
  children: cfg.scheduledTime
6764
6791
  })
6765
6792
  ]
6766
6793
  }),
6767
- cfg.thumbnailUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6794
+ showThumbnail && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6768
6795
  style: {
6769
6796
  flexShrink: 0,
6770
- width: Math.max(40, size.h * 0.75),
6797
+ width: "".concat(thumbW, "px"),
6771
6798
  overflow: "hidden"
6772
6799
  },
6773
6800
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
6774
6801
  src: cfg.thumbnailUrl,
6775
- alt: "thumbnail",
6802
+ alt: "",
6776
6803
  style: {
6777
6804
  width: "100%",
6778
6805
  height: "100%",