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
|
@@ -442,10 +442,10 @@ function TextOverlay(param) {
|
|
|
442
442
|
});
|
|
443
443
|
}
|
|
444
444
|
function parseRSSXml(xmlText, maxItems) {
|
|
445
|
+
var stripped = xmlText.replace(/^<\?xml[^?]*\?>\s*/, "");
|
|
445
446
|
var parser = new DOMParser();
|
|
446
|
-
var doc = parser.parseFromString(
|
|
447
|
-
|
|
448
|
-
return Array.from(doc.querySelectorAll("item")).map(function(item) {
|
|
447
|
+
var doc = parser.parseFromString(stripped, "text/xml");
|
|
448
|
+
var items = Array.from(doc.querySelectorAll("item")).map(function(item) {
|
|
449
449
|
var _item_querySelector, _item_querySelector1, _item_querySelector2, _item_querySelector3, _item_querySelector4;
|
|
450
450
|
return {
|
|
451
451
|
title: (((_item_querySelector = item.querySelector("title")) === null || _item_querySelector === void 0 ? void 0 : _item_querySelector.textContent) || "").replace(/<[^>]*>/g, "").trim(),
|
|
@@ -457,6 +457,26 @@ function parseRSSXml(xmlText, maxItems) {
|
|
|
457
457
|
}).filter(function(i) {
|
|
458
458
|
return i.title;
|
|
459
459
|
}).slice(0, maxItems);
|
|
460
|
+
if (items.length === 0 && doc.querySelector("parsererror")) {
|
|
461
|
+
throw new Error("Invalid RSS XML");
|
|
462
|
+
}
|
|
463
|
+
return items;
|
|
464
|
+
}
|
|
465
|
+
var RSS_CACHE_TTL_MS = 6e4;
|
|
466
|
+
var rssCache = /* @__PURE__ */ new Map();
|
|
467
|
+
function cachedFetchRSSItems(rssUrl, maxItems) {
|
|
468
|
+
var now = Date.now();
|
|
469
|
+
var cached = rssCache.get(rssUrl);
|
|
470
|
+
if (cached && cached.expiresAt > now) return cached.promise;
|
|
471
|
+
var promise = fetchRSSItems(rssUrl, maxItems).catch(function(err) {
|
|
472
|
+
rssCache.delete(rssUrl);
|
|
473
|
+
throw err;
|
|
474
|
+
});
|
|
475
|
+
rssCache.set(rssUrl, {
|
|
476
|
+
promise: promise,
|
|
477
|
+
expiresAt: now + RSS_CACHE_TTL_MS
|
|
478
|
+
});
|
|
479
|
+
return promise;
|
|
460
480
|
}
|
|
461
481
|
function fetchRSSItems(rssUrl, maxItems) {
|
|
462
482
|
return _async_to_generator(function() {
|
|
@@ -610,7 +630,7 @@ function ScrollerOverlay(param) {
|
|
|
610
630
|
var cancelled = false;
|
|
611
631
|
setRssLoading(true);
|
|
612
632
|
setRssError(false);
|
|
613
|
-
|
|
633
|
+
cachedFetchRSSItems(rssUrl, maxItems).then(function(items) {
|
|
614
634
|
if (!cancelled) {
|
|
615
635
|
setRssItems(items);
|
|
616
636
|
setRssError(false);
|
|
@@ -632,7 +652,8 @@ function ScrollerOverlay(param) {
|
|
|
632
652
|
(0, import_react.useEffect)(function() {
|
|
633
653
|
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;
|
|
634
654
|
var interval = setInterval(function() {
|
|
635
|
-
|
|
655
|
+
rssCache.delete(rssUrl);
|
|
656
|
+
cachedFetchRSSItems(rssUrl, maxItems).then(function(items) {
|
|
636
657
|
setRssItems(items);
|
|
637
658
|
setRssError(false);
|
|
638
659
|
}).catch(function() {});
|
|
@@ -1174,25 +1195,29 @@ function ComingUpNextOverlay(param) {
|
|
|
1174
1195
|
var overlay = param.overlay, size = param.size;
|
|
1175
1196
|
var cfg = parseConfig(overlay.content);
|
|
1176
1197
|
if (!cfg) return null;
|
|
1177
|
-
var f = Math.max(
|
|
1198
|
+
var f = Math.max(9, Math.min(size.h * 0.19, size.w * 0.075));
|
|
1199
|
+
var showSubtitle = size.h >= 68;
|
|
1200
|
+
var showThumbnail = !!(cfg.thumbnailUrl && size.h >= 58);
|
|
1201
|
+
var thumbW = showThumbnail ? Math.max(40, size.h * 0.7) : 0;
|
|
1178
1202
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1179
1203
|
style: {
|
|
1180
1204
|
width: "100%",
|
|
1181
1205
|
height: "100%",
|
|
1182
|
-
borderRadius: Math.max(2, size.w * 0.
|
|
1206
|
+
borderRadius: Math.max(2, size.w * 0.025),
|
|
1183
1207
|
display: "flex",
|
|
1184
1208
|
background: cfg.backgroundColor,
|
|
1185
1209
|
color: cfg.textColor,
|
|
1186
|
-
fontFamily: "
|
|
1210
|
+
fontFamily: "'Arial', 'Helvetica Neue', Helvetica, sans-serif",
|
|
1187
1211
|
overflow: "hidden",
|
|
1188
1212
|
pointerEvents: "none",
|
|
1189
1213
|
userSelect: "none",
|
|
1190
|
-
fontSize: "".concat(f, "px")
|
|
1214
|
+
fontSize: "".concat(f, "px"),
|
|
1215
|
+
WebkitFontSmoothing: "antialiased"
|
|
1191
1216
|
},
|
|
1192
1217
|
children: [
|
|
1193
1218
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1194
1219
|
style: {
|
|
1195
|
-
width: Math.max(
|
|
1220
|
+
width: Math.max(3, size.w * 0.018),
|
|
1196
1221
|
flexShrink: 0,
|
|
1197
1222
|
backgroundColor: cfg.accentColor
|
|
1198
1223
|
}
|
|
@@ -1203,36 +1228,38 @@ function ComingUpNextOverlay(param) {
|
|
|
1203
1228
|
display: "flex",
|
|
1204
1229
|
flexDirection: "column",
|
|
1205
1230
|
justifyContent: "center",
|
|
1206
|
-
padding: "".concat(f * 0.
|
|
1207
|
-
minWidth: 0
|
|
1231
|
+
padding: "".concat(f * 0.35, "px ").concat(f * 0.75, "px"),
|
|
1232
|
+
minWidth: 0,
|
|
1233
|
+
gap: "".concat(f * 0.08, "px")
|
|
1208
1234
|
},
|
|
1209
1235
|
children: [
|
|
1210
1236
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1211
1237
|
style: {
|
|
1212
|
-
fontSize: "0.
|
|
1213
|
-
fontWeight:
|
|
1238
|
+
fontSize: "0.7em",
|
|
1239
|
+
fontWeight: 700,
|
|
1214
1240
|
textTransform: "uppercase",
|
|
1215
|
-
letterSpacing: "0.
|
|
1216
|
-
color: cfg.accentColor
|
|
1241
|
+
letterSpacing: "0.09em",
|
|
1242
|
+
color: cfg.accentColor,
|
|
1243
|
+
lineHeight: 1
|
|
1217
1244
|
},
|
|
1218
1245
|
children: "Coming Up Next"
|
|
1219
1246
|
}),
|
|
1220
1247
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1221
1248
|
style: {
|
|
1222
|
-
fontSize: "1.
|
|
1249
|
+
fontSize: "1.35em",
|
|
1223
1250
|
fontWeight: 700,
|
|
1224
|
-
lineHeight: 1.
|
|
1225
|
-
marginTop: f * 0.2,
|
|
1251
|
+
lineHeight: 1.15,
|
|
1226
1252
|
overflow: "hidden",
|
|
1227
1253
|
textOverflow: "ellipsis",
|
|
1228
1254
|
whiteSpace: "nowrap"
|
|
1229
1255
|
},
|
|
1230
1256
|
children: cfg.title
|
|
1231
1257
|
}),
|
|
1232
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1258
|
+
showSubtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1233
1259
|
style: {
|
|
1234
|
-
fontSize: "0.
|
|
1235
|
-
opacity: 0.
|
|
1260
|
+
fontSize: "0.82em",
|
|
1261
|
+
opacity: 0.65,
|
|
1262
|
+
lineHeight: 1.1,
|
|
1236
1263
|
overflow: "hidden",
|
|
1237
1264
|
textOverflow: "ellipsis",
|
|
1238
1265
|
whiteSpace: "nowrap"
|
|
@@ -1241,24 +1268,24 @@ function ComingUpNextOverlay(param) {
|
|
|
1241
1268
|
}),
|
|
1242
1269
|
cfg.scheduledTime && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1243
1270
|
style: {
|
|
1244
|
-
fontSize: "
|
|
1245
|
-
fontWeight:
|
|
1246
|
-
|
|
1247
|
-
|
|
1271
|
+
fontSize: "0.9em",
|
|
1272
|
+
fontWeight: 700,
|
|
1273
|
+
color: cfg.accentColor,
|
|
1274
|
+
lineHeight: 1
|
|
1248
1275
|
},
|
|
1249
1276
|
children: cfg.scheduledTime
|
|
1250
1277
|
})
|
|
1251
1278
|
]
|
|
1252
1279
|
}),
|
|
1253
|
-
|
|
1280
|
+
showThumbnail && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1254
1281
|
style: {
|
|
1255
1282
|
flexShrink: 0,
|
|
1256
|
-
width:
|
|
1283
|
+
width: "".concat(thumbW, "px"),
|
|
1257
1284
|
overflow: "hidden"
|
|
1258
1285
|
},
|
|
1259
1286
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
|
|
1260
1287
|
src: cfg.thumbnailUrl,
|
|
1261
|
-
alt: "
|
|
1288
|
+
alt: "",
|
|
1262
1289
|
style: {
|
|
1263
1290
|
width: "100%",
|
|
1264
1291
|
height: "100%",
|