@geekapps/silo-elements-nextjs 0.2.68 → 0.2.70
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/FileUploader.d.ts +1 -1
- package/dist/FileUploader.js +14 -3
- package/dist/FileUploader.js.map +1 -1
- package/dist/MediaUploader.js +14 -3
- package/dist/MediaUploader.js.map +1 -1
- package/dist/VideoPlayer.js +52 -17
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.js +66 -20
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/styles.css +1 -1
package/dist/index.js
CHANGED
|
@@ -737,6 +737,7 @@ function FileUploader({
|
|
|
737
737
|
video,
|
|
738
738
|
isPrivate,
|
|
739
739
|
captionLanguages,
|
|
740
|
+
chapterLanguages,
|
|
740
741
|
theme,
|
|
741
742
|
renderIcon,
|
|
742
743
|
renderProgress,
|
|
@@ -780,12 +781,21 @@ function FileUploader({
|
|
|
780
781
|
const resolvedVideo = overrideVideo ?? videoOpts;
|
|
781
782
|
const effectiveImage = showImageOptions ? resolvedImage : image ?? resolvedImage;
|
|
782
783
|
const effectiveVideo = showVideoOptions ? resolvedVideo : video ?? resolvedVideo;
|
|
784
|
+
const videoWithLangs = (base) => {
|
|
785
|
+
if (!captionLanguages?.length && !chapterLanguages?.length) return base;
|
|
786
|
+
return {
|
|
787
|
+
...base ?? {},
|
|
788
|
+
...captionLanguages?.length && { languages: captionLanguages },
|
|
789
|
+
...chapterLanguages?.length && { chapterLanguages }
|
|
790
|
+
};
|
|
791
|
+
};
|
|
783
792
|
if (multiple && files.length > 1) {
|
|
784
793
|
try {
|
|
794
|
+
const batchVideo = videoWithLangs(effectiveVideo);
|
|
785
795
|
const results = await batch.upload(files, {
|
|
786
796
|
...bucket !== void 0 && { bucket },
|
|
787
797
|
image: effectiveImage,
|
|
788
|
-
video:
|
|
798
|
+
...batchVideo !== void 0 && { video: batchVideo },
|
|
789
799
|
...isPrivate !== void 0 && { isPrivate },
|
|
790
800
|
...captionLanguages?.length && { captionLanguages }
|
|
791
801
|
});
|
|
@@ -798,10 +808,11 @@ function FileUploader({
|
|
|
798
808
|
const file = files[0];
|
|
799
809
|
if (!file) return;
|
|
800
810
|
try {
|
|
811
|
+
const singleVideo = videoWithLangs(effectiveVideo);
|
|
801
812
|
const result = await single.upload(file, {
|
|
802
813
|
...bucket !== void 0 && { bucket },
|
|
803
814
|
image: effectiveImage,
|
|
804
|
-
|
|
815
|
+
...singleVideo !== void 0 && { video: singleVideo },
|
|
805
816
|
...isPrivate !== void 0 && { isPrivate }
|
|
806
817
|
});
|
|
807
818
|
if (result) onUpload?.(result);
|
|
@@ -809,7 +820,7 @@ function FileUploader({
|
|
|
809
820
|
onError?.(err instanceof Error ? err : new Error(String(err)));
|
|
810
821
|
}
|
|
811
822
|
}
|
|
812
|
-
}, [single, batch, multiple, bucket, image, video, isPrivate, captionLanguages, imageOpts, videoOpts, showImageOptions, showVideoOptions, onUpload, onBatchUpload, onError]);
|
|
823
|
+
}, [single, batch, multiple, bucket, image, video, isPrivate, captionLanguages, chapterLanguages, imageOpts, videoOpts, showImageOptions, showVideoOptions, onUpload, onBatchUpload, onError]);
|
|
813
824
|
const handleFiles = useCallback(async (files) => {
|
|
814
825
|
const needsStaging = allowRename || showImageOptions && files.some((f) => f.type.startsWith("image/")) || showVideoOptions && files.some((f) => f.type.startsWith("video/"));
|
|
815
826
|
if (needsStaging) {
|
|
@@ -1296,6 +1307,7 @@ function Video({
|
|
|
1296
1307
|
const [hasPlayed, setHasPlayed] = useState(false);
|
|
1297
1308
|
const [ageRatingOverlay, setAgeRatingOverlay] = useState(false);
|
|
1298
1309
|
const ageRatingTimerRef = useRef(null);
|
|
1310
|
+
const ageRatingPauseTimerRef = useRef(null);
|
|
1299
1311
|
const [clickIcon, setClickIcon] = useState(null);
|
|
1300
1312
|
const clickIconTimerRef = useRef(null);
|
|
1301
1313
|
const [isLoading, setIsLoading] = useState(true);
|
|
@@ -1419,14 +1431,22 @@ function Video({
|
|
|
1419
1431
|
setDuration(Number.isFinite(video.duration) ? video.duration : 0);
|
|
1420
1432
|
applySubtitleMode(subtitleMode);
|
|
1421
1433
|
};
|
|
1434
|
+
const showAgeRating = () => {
|
|
1435
|
+
if (!parsed.ageRating?.data) return;
|
|
1436
|
+
if (ageRatingTimerRef.current) window.clearTimeout(ageRatingTimerRef.current);
|
|
1437
|
+
ageRatingTimerRef.current = window.setTimeout(() => {
|
|
1438
|
+
setAgeRatingOverlay(true);
|
|
1439
|
+
ageRatingTimerRef.current = window.setTimeout(() => setAgeRatingOverlay(false), 8e3);
|
|
1440
|
+
}, 600);
|
|
1441
|
+
};
|
|
1422
1442
|
const onPlay = () => {
|
|
1423
1443
|
setIsPlaying(true);
|
|
1444
|
+
if (ageRatingPauseTimerRef.current) {
|
|
1445
|
+
window.clearTimeout(ageRatingPauseTimerRef.current);
|
|
1446
|
+
ageRatingPauseTimerRef.current = null;
|
|
1447
|
+
}
|
|
1424
1448
|
setHasPlayed((prev) => {
|
|
1425
|
-
if (!prev
|
|
1426
|
-
setAgeRatingOverlay(true);
|
|
1427
|
-
if (ageRatingTimerRef.current) window.clearTimeout(ageRatingTimerRef.current);
|
|
1428
|
-
ageRatingTimerRef.current = window.setTimeout(() => setAgeRatingOverlay(false), 4e3);
|
|
1429
|
-
}
|
|
1449
|
+
if (!prev) showAgeRating();
|
|
1430
1450
|
return true;
|
|
1431
1451
|
});
|
|
1432
1452
|
showControlsTemporarily();
|
|
@@ -1434,6 +1454,13 @@ function Video({
|
|
|
1434
1454
|
const onPause = () => {
|
|
1435
1455
|
setIsPlaying(false);
|
|
1436
1456
|
setControlsVisible(true);
|
|
1457
|
+
if (parsed.ageRating?.data) {
|
|
1458
|
+
if (ageRatingPauseTimerRef.current) window.clearTimeout(ageRatingPauseTimerRef.current);
|
|
1459
|
+
ageRatingPauseTimerRef.current = window.setTimeout(() => {
|
|
1460
|
+
showAgeRating();
|
|
1461
|
+
ageRatingPauseTimerRef.current = null;
|
|
1462
|
+
}, 5 * 60 * 1e3);
|
|
1463
|
+
}
|
|
1437
1464
|
};
|
|
1438
1465
|
const onWaiting = () => setIsLoading(true);
|
|
1439
1466
|
const onCanPlay = () => setIsLoading(false);
|
|
@@ -1457,6 +1484,8 @@ function Video({
|
|
|
1457
1484
|
video.removeEventListener("waiting", onWaiting);
|
|
1458
1485
|
video.removeEventListener("canplay", onCanPlay);
|
|
1459
1486
|
video.removeEventListener("ended", onEnded);
|
|
1487
|
+
if (ageRatingTimerRef.current) window.clearTimeout(ageRatingTimerRef.current);
|
|
1488
|
+
if (ageRatingPauseTimerRef.current) window.clearTimeout(ageRatingPauseTimerRef.current);
|
|
1460
1489
|
};
|
|
1461
1490
|
}, [applySubtitleMode, subtitleMode, showControlsTemporarily]);
|
|
1462
1491
|
useEffect(() => {
|
|
@@ -2114,7 +2143,11 @@ function Video({
|
|
|
2114
2143
|
ref: containerRef,
|
|
2115
2144
|
className: `@container mx-auto w-full max-w-6xl${className ?? ""}`,
|
|
2116
2145
|
children: [
|
|
2117
|
-
/* @__PURE__ */ jsx("style", { children:
|
|
2146
|
+
/* @__PURE__ */ jsx("style", { children: `
|
|
2147
|
+
@keyframes silo-ar-bg{0%{opacity:0}10%{opacity:1}80%{opacity:1}100%{opacity:0}}
|
|
2148
|
+
@keyframes silo-ar-icon{0%,8%{opacity:0;transform:scale(0.82)}18%{opacity:1;transform:scale(1)}80%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(1)}}
|
|
2149
|
+
@keyframes silo-ar-text{0%,18%{opacity:0;transform:translateX(-6px)}30%{opacity:1;transform:translateX(0)}80%{opacity:1;transform:translateX(0)}100%{opacity:0;transform:translateX(0)}}
|
|
2150
|
+
` }),
|
|
2118
2151
|
/* @__PURE__ */ jsxs(
|
|
2119
2152
|
"div",
|
|
2120
2153
|
{
|
|
@@ -2189,16 +2222,20 @@ function Video({
|
|
|
2189
2222
|
const code = ar.data[regionKey];
|
|
2190
2223
|
const lookupKey = `${regionKey}:${code}`;
|
|
2191
2224
|
const info = ar.lookup?.[lookupKey];
|
|
2225
|
+
const dur = "8s";
|
|
2192
2226
|
return /* @__PURE__ */ jsx(
|
|
2193
2227
|
"div",
|
|
2194
2228
|
{
|
|
2195
|
-
className: "pointer-events-none absolute inset-0 z-40 flex items-
|
|
2196
|
-
style: {
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2229
|
+
className: "pointer-events-none absolute inset-0 z-40 flex items-end justify-start",
|
|
2230
|
+
style: {
|
|
2231
|
+
background: "linear-gradient(to right, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.45) 38%, transparent 62%)",
|
|
2232
|
+
animation: `silo-ar-bg ${dur} forwards`
|
|
2233
|
+
},
|
|
2234
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3.5 px-6 py-6 @sm:px-8 @sm:py-8", children: [
|
|
2235
|
+
/* @__PURE__ */ jsx("div", { style: { animation: `silo-ar-icon ${dur} forwards` }, children: info?.imageUrl ? /* @__PURE__ */ jsx("img", { src: info.imageUrl, alt: code, className: "h-14 w-auto object-contain @sm:h-16 drop-shadow-[0_2px_8px_rgba(0,0,0,0.6)]" }) : /* @__PURE__ */ jsx("span", { className: "flex h-14 min-w-14 items-center justify-center rounded-md border-2 border-white/40 px-2 text-lg font-bold text-white @sm:h-16 @sm:min-w-16 @sm:text-xl drop-shadow-[0_2px_8px_rgba(0,0,0,0.6)]", children: code }) }),
|
|
2236
|
+
(info?.title || info?.description) && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", style: { animation: `silo-ar-text ${dur} forwards` }, children: [
|
|
2237
|
+
info.title && /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-white @sm:text-base drop-shadow-[0_1px_4px_rgba(0,0,0,0.8)]", children: info.title }),
|
|
2238
|
+
info.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-white/70 leading-snug max-w-56 @sm:text-sm @sm:max-w-72 drop-shadow-[0_1px_4px_rgba(0,0,0,0.8)]", children: info.description })
|
|
2202
2239
|
] })
|
|
2203
2240
|
] })
|
|
2204
2241
|
}
|
|
@@ -2866,12 +2903,21 @@ function Video({
|
|
|
2866
2903
|
)
|
|
2867
2904
|
}
|
|
2868
2905
|
),
|
|
2869
|
-
/* @__PURE__ */
|
|
2870
|
-
"
|
|
2906
|
+
/* @__PURE__ */ jsxs(
|
|
2907
|
+
"div",
|
|
2871
2908
|
{
|
|
2872
|
-
className: "rounded-md px-2 py-0.5 text-[11px] font-semibold
|
|
2909
|
+
className: "flex items-center gap-1.5 rounded-md px-2 py-0.5 text-[11px] font-semibold text-white/90",
|
|
2873
2910
|
style: { background: "rgba(0,0,0,0.55)", backdropFilter: "blur(6px)" },
|
|
2874
|
-
children:
|
|
2911
|
+
children: [
|
|
2912
|
+
/* @__PURE__ */ jsx("span", { className: "tabular-nums", children: formatTime(preview.time) }),
|
|
2913
|
+
(() => {
|
|
2914
|
+
const ch = [...chapters].reverse().find((c) => c.startTime <= preview.time);
|
|
2915
|
+
return ch ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2916
|
+
/* @__PURE__ */ jsx("span", { className: "text-white/40", children: "\xB7" }),
|
|
2917
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-36 truncate", children: ch.title })
|
|
2918
|
+
] }) : null;
|
|
2919
|
+
})()
|
|
2920
|
+
]
|
|
2875
2921
|
}
|
|
2876
2922
|
)
|
|
2877
2923
|
]
|