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.js CHANGED
@@ -5790,10 +5790,10 @@ function TextOverlay(param) {
5790
5790
  });
5791
5791
  }
5792
5792
  function parseRSSXml(xmlText, maxItems) {
5793
+ var stripped = xmlText.replace(/^<\?xml[^?]*\?>\s*/, "");
5793
5794
  var parser = new DOMParser();
5794
- var doc = parser.parseFromString(xmlText, "text/xml");
5795
- if (doc.querySelector("parsererror")) throw new Error("Invalid RSS XML");
5796
- return Array.from(doc.querySelectorAll("item")).map(function(item) {
5795
+ var doc = parser.parseFromString(stripped, "text/xml");
5796
+ var items = Array.from(doc.querySelectorAll("item")).map(function(item) {
5797
5797
  var _item_querySelector, _item_querySelector1, _item_querySelector2, _item_querySelector3, _item_querySelector4;
5798
5798
  return {
5799
5799
  title: (((_item_querySelector = item.querySelector("title")) === null || _item_querySelector === void 0 ? void 0 : _item_querySelector.textContent) || "").replace(/<[^>]*>/g, "").trim(),
@@ -5805,6 +5805,26 @@ function parseRSSXml(xmlText, maxItems) {
5805
5805
  }).filter(function(i) {
5806
5806
  return i.title;
5807
5807
  }).slice(0, maxItems);
5808
+ if (items.length === 0 && doc.querySelector("parsererror")) {
5809
+ throw new Error("Invalid RSS XML");
5810
+ }
5811
+ return items;
5812
+ }
5813
+ var RSS_CACHE_TTL_MS = 6e4;
5814
+ var rssCache = /* @__PURE__ */ new Map();
5815
+ function cachedFetchRSSItems(rssUrl, maxItems) {
5816
+ var now = Date.now();
5817
+ var cached = rssCache.get(rssUrl);
5818
+ if (cached && cached.expiresAt > now) return cached.promise;
5819
+ var promise = fetchRSSItems(rssUrl, maxItems).catch(function(err) {
5820
+ rssCache.delete(rssUrl);
5821
+ throw err;
5822
+ });
5823
+ rssCache.set(rssUrl, {
5824
+ promise: promise,
5825
+ expiresAt: now + RSS_CACHE_TTL_MS
5826
+ });
5827
+ return promise;
5808
5828
  }
5809
5829
  function fetchRSSItems(rssUrl, maxItems) {
5810
5830
  return _async_to_generator(function() {
@@ -5958,7 +5978,7 @@ function ScrollerOverlay(param) {
5958
5978
  var cancelled = false;
5959
5979
  setRssLoading(true);
5960
5980
  setRssError(false);
5961
- fetchRSSItems(rssUrl, maxItems).then(function(items) {
5981
+ cachedFetchRSSItems(rssUrl, maxItems).then(function(items) {
5962
5982
  if (!cancelled) {
5963
5983
  setRssItems(items);
5964
5984
  setRssError(false);
@@ -5980,7 +6000,8 @@ function ScrollerOverlay(param) {
5980
6000
  useEffect(function() {
5981
6001
  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;
5982
6002
  var interval = setInterval(function() {
5983
- fetchRSSItems(rssUrl, maxItems).then(function(items) {
6003
+ rssCache.delete(rssUrl);
6004
+ cachedFetchRSSItems(rssUrl, maxItems).then(function(items) {
5984
6005
  setRssItems(items);
5985
6006
  setRssError(false);
5986
6007
  }).catch(function() {});
@@ -6522,25 +6543,29 @@ function ComingUpNextOverlay(param) {
6522
6543
  var overlay = param.overlay, size = param.size;
6523
6544
  var cfg = parseConfig(overlay.content);
6524
6545
  if (!cfg) return null;
6525
- var f = Math.max(6, size.w * 0.05);
6546
+ var f = Math.max(9, Math.min(size.h * 0.19, size.w * 0.075));
6547
+ var showSubtitle = size.h >= 68;
6548
+ var showThumbnail = !!(cfg.thumbnailUrl && size.h >= 58);
6549
+ var thumbW = showThumbnail ? Math.max(40, size.h * 0.7) : 0;
6526
6550
  return /* @__PURE__ */ jsxs("div", {
6527
6551
  style: {
6528
6552
  width: "100%",
6529
6553
  height: "100%",
6530
- borderRadius: Math.max(2, size.w * 0.035),
6554
+ borderRadius: Math.max(2, size.w * 0.025),
6531
6555
  display: "flex",
6532
6556
  background: cfg.backgroundColor,
6533
6557
  color: cfg.textColor,
6534
- fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
6558
+ fontFamily: "'Arial', 'Helvetica Neue', Helvetica, sans-serif",
6535
6559
  overflow: "hidden",
6536
6560
  pointerEvents: "none",
6537
6561
  userSelect: "none",
6538
- fontSize: "".concat(f, "px")
6562
+ fontSize: "".concat(f, "px"),
6563
+ WebkitFontSmoothing: "antialiased"
6539
6564
  },
6540
6565
  children: [
6541
6566
  /* @__PURE__ */ jsx("div", {
6542
6567
  style: {
6543
- width: Math.max(2, size.w * 0.015),
6568
+ width: Math.max(3, size.w * 0.018),
6544
6569
  flexShrink: 0,
6545
6570
  backgroundColor: cfg.accentColor
6546
6571
  }
@@ -6551,36 +6576,38 @@ function ComingUpNextOverlay(param) {
6551
6576
  display: "flex",
6552
6577
  flexDirection: "column",
6553
6578
  justifyContent: "center",
6554
- padding: "".concat(f * 0.6, "px ").concat(f * 1, "px"),
6555
- minWidth: 0
6579
+ padding: "".concat(f * 0.35, "px ").concat(f * 0.75, "px"),
6580
+ minWidth: 0,
6581
+ gap: "".concat(f * 0.08, "px")
6556
6582
  },
6557
6583
  children: [
6558
6584
  /* @__PURE__ */ jsx("div", {
6559
6585
  style: {
6560
- fontSize: "0.8em",
6561
- fontWeight: 600,
6586
+ fontSize: "0.7em",
6587
+ fontWeight: 700,
6562
6588
  textTransform: "uppercase",
6563
- letterSpacing: "0.05em",
6564
- color: cfg.accentColor
6589
+ letterSpacing: "0.09em",
6590
+ color: cfg.accentColor,
6591
+ lineHeight: 1
6565
6592
  },
6566
6593
  children: "Coming Up Next"
6567
6594
  }),
6568
6595
  /* @__PURE__ */ jsx("div", {
6569
6596
  style: {
6570
- fontSize: "1.5em",
6597
+ fontSize: "1.35em",
6571
6598
  fontWeight: 700,
6572
- lineHeight: 1.2,
6573
- marginTop: f * 0.2,
6599
+ lineHeight: 1.15,
6574
6600
  overflow: "hidden",
6575
6601
  textOverflow: "ellipsis",
6576
6602
  whiteSpace: "nowrap"
6577
6603
  },
6578
6604
  children: cfg.title
6579
6605
  }),
6580
- /* @__PURE__ */ jsx("div", {
6606
+ showSubtitle && /* @__PURE__ */ jsx("div", {
6581
6607
  style: {
6582
- fontSize: "0.9em",
6583
- opacity: 0.6,
6608
+ fontSize: "0.82em",
6609
+ opacity: 0.65,
6610
+ lineHeight: 1.1,
6584
6611
  overflow: "hidden",
6585
6612
  textOverflow: "ellipsis",
6586
6613
  whiteSpace: "nowrap"
@@ -6589,24 +6616,24 @@ function ComingUpNextOverlay(param) {
6589
6616
  }),
6590
6617
  cfg.scheduledTime && /* @__PURE__ */ jsx("div", {
6591
6618
  style: {
6592
- fontSize: "1em",
6593
- fontWeight: 600,
6594
- marginTop: f * 0.4,
6595
- color: cfg.accentColor
6619
+ fontSize: "0.9em",
6620
+ fontWeight: 700,
6621
+ color: cfg.accentColor,
6622
+ lineHeight: 1
6596
6623
  },
6597
6624
  children: cfg.scheduledTime
6598
6625
  })
6599
6626
  ]
6600
6627
  }),
6601
- cfg.thumbnailUrl && /* @__PURE__ */ jsx("div", {
6628
+ showThumbnail && /* @__PURE__ */ jsx("div", {
6602
6629
  style: {
6603
6630
  flexShrink: 0,
6604
- width: Math.max(40, size.h * 0.75),
6631
+ width: "".concat(thumbW, "px"),
6605
6632
  overflow: "hidden"
6606
6633
  },
6607
6634
  children: /* @__PURE__ */ jsx("img", {
6608
6635
  src: cfg.thumbnailUrl,
6609
- alt: "thumbnail",
6636
+ alt: "",
6610
6637
  style: {
6611
6638
  width: "100%",
6612
6639
  height: "100%",