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/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +56 -29
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +56 -29
- package/lib/index.js.map +1 -1
- package/lib/ui/OverlayRenderer.cjs +56 -29
- package/lib/ui/OverlayRenderer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +56 -29
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -5778,10 +5778,10 @@ function TextOverlay(param) {
|
|
|
5778
5778
|
});
|
|
5779
5779
|
}
|
|
5780
5780
|
function parseRSSXml(xmlText, maxItems) {
|
|
5781
|
+
var stripped = xmlText.replace(/^<\?xml[^?]*\?>\s*/, "");
|
|
5781
5782
|
var parser = new DOMParser();
|
|
5782
|
-
var doc = parser.parseFromString(
|
|
5783
|
-
|
|
5784
|
-
return Array.from(doc.querySelectorAll("item")).map(function(item) {
|
|
5783
|
+
var doc = parser.parseFromString(stripped, "text/xml");
|
|
5784
|
+
var items = Array.from(doc.querySelectorAll("item")).map(function(item) {
|
|
5785
5785
|
var _item_querySelector, _item_querySelector1, _item_querySelector2, _item_querySelector3, _item_querySelector4;
|
|
5786
5786
|
return {
|
|
5787
5787
|
title: (((_item_querySelector = item.querySelector("title")) === null || _item_querySelector === void 0 ? void 0 : _item_querySelector.textContent) || "").replace(/<[^>]*>/g, "").trim(),
|
|
@@ -5793,6 +5793,26 @@ function parseRSSXml(xmlText, maxItems) {
|
|
|
5793
5793
|
}).filter(function(i) {
|
|
5794
5794
|
return i.title;
|
|
5795
5795
|
}).slice(0, maxItems);
|
|
5796
|
+
if (items.length === 0 && doc.querySelector("parsererror")) {
|
|
5797
|
+
throw new Error("Invalid RSS XML");
|
|
5798
|
+
}
|
|
5799
|
+
return items;
|
|
5800
|
+
}
|
|
5801
|
+
var RSS_CACHE_TTL_MS = 6e4;
|
|
5802
|
+
var rssCache = /* @__PURE__ */ new Map();
|
|
5803
|
+
function cachedFetchRSSItems(rssUrl, maxItems) {
|
|
5804
|
+
var now = Date.now();
|
|
5805
|
+
var cached = rssCache.get(rssUrl);
|
|
5806
|
+
if (cached && cached.expiresAt > now) return cached.promise;
|
|
5807
|
+
var promise = fetchRSSItems(rssUrl, maxItems).catch(function(err) {
|
|
5808
|
+
rssCache.delete(rssUrl);
|
|
5809
|
+
throw err;
|
|
5810
|
+
});
|
|
5811
|
+
rssCache.set(rssUrl, {
|
|
5812
|
+
promise: promise,
|
|
5813
|
+
expiresAt: now + RSS_CACHE_TTL_MS
|
|
5814
|
+
});
|
|
5815
|
+
return promise;
|
|
5796
5816
|
}
|
|
5797
5817
|
function fetchRSSItems(rssUrl, maxItems) {
|
|
5798
5818
|
return _async_to_generator(function() {
|
|
@@ -5946,7 +5966,7 @@ function ScrollerOverlay(param) {
|
|
|
5946
5966
|
var cancelled = false;
|
|
5947
5967
|
setRssLoading(true);
|
|
5948
5968
|
setRssError(false);
|
|
5949
|
-
|
|
5969
|
+
cachedFetchRSSItems(rssUrl, maxItems).then(function(items) {
|
|
5950
5970
|
if (!cancelled) {
|
|
5951
5971
|
setRssItems(items);
|
|
5952
5972
|
setRssError(false);
|
|
@@ -5968,7 +5988,8 @@ function ScrollerOverlay(param) {
|
|
|
5968
5988
|
(0, import_react.useEffect)(function() {
|
|
5969
5989
|
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;
|
|
5970
5990
|
var interval = setInterval(function() {
|
|
5971
|
-
|
|
5991
|
+
rssCache.delete(rssUrl);
|
|
5992
|
+
cachedFetchRSSItems(rssUrl, maxItems).then(function(items) {
|
|
5972
5993
|
setRssItems(items);
|
|
5973
5994
|
setRssError(false);
|
|
5974
5995
|
}).catch(function() {});
|
|
@@ -6510,25 +6531,29 @@ function ComingUpNextOverlay(param) {
|
|
|
6510
6531
|
var overlay = param.overlay, size = param.size;
|
|
6511
6532
|
var cfg = parseConfig(overlay.content);
|
|
6512
6533
|
if (!cfg) return null;
|
|
6513
|
-
var f = Math.max(
|
|
6534
|
+
var f = Math.max(9, Math.min(size.h * 0.19, size.w * 0.075));
|
|
6535
|
+
var showSubtitle = size.h >= 68;
|
|
6536
|
+
var showThumbnail = !!(cfg.thumbnailUrl && size.h >= 58);
|
|
6537
|
+
var thumbW = showThumbnail ? Math.max(40, size.h * 0.7) : 0;
|
|
6514
6538
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6515
6539
|
style: {
|
|
6516
6540
|
width: "100%",
|
|
6517
6541
|
height: "100%",
|
|
6518
|
-
borderRadius: Math.max(2, size.w * 0.
|
|
6542
|
+
borderRadius: Math.max(2, size.w * 0.025),
|
|
6519
6543
|
display: "flex",
|
|
6520
6544
|
background: cfg.backgroundColor,
|
|
6521
6545
|
color: cfg.textColor,
|
|
6522
|
-
fontFamily: "
|
|
6546
|
+
fontFamily: "'Arial', 'Helvetica Neue', Helvetica, sans-serif",
|
|
6523
6547
|
overflow: "hidden",
|
|
6524
6548
|
pointerEvents: "none",
|
|
6525
6549
|
userSelect: "none",
|
|
6526
|
-
fontSize: "".concat(f, "px")
|
|
6550
|
+
fontSize: "".concat(f, "px"),
|
|
6551
|
+
WebkitFontSmoothing: "antialiased"
|
|
6527
6552
|
},
|
|
6528
6553
|
children: [
|
|
6529
6554
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6530
6555
|
style: {
|
|
6531
|
-
width: Math.max(
|
|
6556
|
+
width: Math.max(3, size.w * 0.018),
|
|
6532
6557
|
flexShrink: 0,
|
|
6533
6558
|
backgroundColor: cfg.accentColor
|
|
6534
6559
|
}
|
|
@@ -6539,36 +6564,38 @@ function ComingUpNextOverlay(param) {
|
|
|
6539
6564
|
display: "flex",
|
|
6540
6565
|
flexDirection: "column",
|
|
6541
6566
|
justifyContent: "center",
|
|
6542
|
-
padding: "".concat(f * 0.
|
|
6543
|
-
minWidth: 0
|
|
6567
|
+
padding: "".concat(f * 0.35, "px ").concat(f * 0.75, "px"),
|
|
6568
|
+
minWidth: 0,
|
|
6569
|
+
gap: "".concat(f * 0.08, "px")
|
|
6544
6570
|
},
|
|
6545
6571
|
children: [
|
|
6546
6572
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6547
6573
|
style: {
|
|
6548
|
-
fontSize: "0.
|
|
6549
|
-
fontWeight:
|
|
6574
|
+
fontSize: "0.7em",
|
|
6575
|
+
fontWeight: 700,
|
|
6550
6576
|
textTransform: "uppercase",
|
|
6551
|
-
letterSpacing: "0.
|
|
6552
|
-
color: cfg.accentColor
|
|
6577
|
+
letterSpacing: "0.09em",
|
|
6578
|
+
color: cfg.accentColor,
|
|
6579
|
+
lineHeight: 1
|
|
6553
6580
|
},
|
|
6554
6581
|
children: "Coming Up Next"
|
|
6555
6582
|
}),
|
|
6556
6583
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6557
6584
|
style: {
|
|
6558
|
-
fontSize: "1.
|
|
6585
|
+
fontSize: "1.35em",
|
|
6559
6586
|
fontWeight: 700,
|
|
6560
|
-
lineHeight: 1.
|
|
6561
|
-
marginTop: f * 0.2,
|
|
6587
|
+
lineHeight: 1.15,
|
|
6562
6588
|
overflow: "hidden",
|
|
6563
6589
|
textOverflow: "ellipsis",
|
|
6564
6590
|
whiteSpace: "nowrap"
|
|
6565
6591
|
},
|
|
6566
6592
|
children: cfg.title
|
|
6567
6593
|
}),
|
|
6568
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6594
|
+
showSubtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6569
6595
|
style: {
|
|
6570
|
-
fontSize: "0.
|
|
6571
|
-
opacity: 0.
|
|
6596
|
+
fontSize: "0.82em",
|
|
6597
|
+
opacity: 0.65,
|
|
6598
|
+
lineHeight: 1.1,
|
|
6572
6599
|
overflow: "hidden",
|
|
6573
6600
|
textOverflow: "ellipsis",
|
|
6574
6601
|
whiteSpace: "nowrap"
|
|
@@ -6577,24 +6604,24 @@ function ComingUpNextOverlay(param) {
|
|
|
6577
6604
|
}),
|
|
6578
6605
|
cfg.scheduledTime && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6579
6606
|
style: {
|
|
6580
|
-
fontSize: "
|
|
6581
|
-
fontWeight:
|
|
6582
|
-
|
|
6583
|
-
|
|
6607
|
+
fontSize: "0.9em",
|
|
6608
|
+
fontWeight: 700,
|
|
6609
|
+
color: cfg.accentColor,
|
|
6610
|
+
lineHeight: 1
|
|
6584
6611
|
},
|
|
6585
6612
|
children: cfg.scheduledTime
|
|
6586
6613
|
})
|
|
6587
6614
|
]
|
|
6588
6615
|
}),
|
|
6589
|
-
|
|
6616
|
+
showThumbnail && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6590
6617
|
style: {
|
|
6591
6618
|
flexShrink: 0,
|
|
6592
|
-
width:
|
|
6619
|
+
width: "".concat(thumbW, "px"),
|
|
6593
6620
|
overflow: "hidden"
|
|
6594
6621
|
},
|
|
6595
6622
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
|
|
6596
6623
|
src: cfg.thumbnailUrl,
|
|
6597
|
-
alt: "
|
|
6624
|
+
alt: "",
|
|
6598
6625
|
style: {
|
|
6599
6626
|
width: "100%",
|
|
6600
6627
|
height: "100%",
|