@geekapps/silo-elements-nextjs 0.3.2 → 0.3.4
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.js +165 -36
- package/dist/FileUploader.js.map +1 -1
- package/dist/MediaUploader.js +165 -36
- package/dist/MediaUploader.js.map +1 -1
- package/dist/VideoPlayer.js +33 -12
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/VideoUploader.js +165 -36
- package/dist/VideoUploader.js.map +1 -1
- package/dist/index.js +198 -48
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/styles.css +1 -1
package/dist/VideoPlayer.js
CHANGED
|
@@ -183,6 +183,9 @@ function Video({
|
|
|
183
183
|
const ageRatingWrapRef = useRef(null);
|
|
184
184
|
const ageRatingIconRef = useRef(null);
|
|
185
185
|
const ageRatingTextRef = useRef(null);
|
|
186
|
+
const ageRatingShownRef = useRef(false);
|
|
187
|
+
const ageRatingQueuedRef = useRef(false);
|
|
188
|
+
const ageRatingPendingRef = useRef(false);
|
|
186
189
|
const [clickIcon, setClickIcon] = useState(null);
|
|
187
190
|
const clickIconTimerRef = useRef(null);
|
|
188
191
|
const clickIconRef = useRef(null);
|
|
@@ -257,9 +260,6 @@ function Video({
|
|
|
257
260
|
setControlsVisible(false);
|
|
258
261
|
}, 2400);
|
|
259
262
|
}
|
|
260
|
-
if (video?.paused) {
|
|
261
|
-
showAgeRatingRef.current?.();
|
|
262
|
-
}
|
|
263
263
|
}, [autoHideControls]);
|
|
264
264
|
useEffect(() => {
|
|
265
265
|
if (!containerRef.current) return;
|
|
@@ -335,7 +335,13 @@ function Video({
|
|
|
335
335
|
gsap.to(el, {
|
|
336
336
|
opacity: controlsVisible ? 1 : 0,
|
|
337
337
|
duration: 0.2,
|
|
338
|
-
ease: "power1.inOut"
|
|
338
|
+
ease: "power1.inOut",
|
|
339
|
+
onComplete: () => {
|
|
340
|
+
if (!controlsVisible && ageRatingPendingRef.current) {
|
|
341
|
+
ageRatingPendingRef.current = false;
|
|
342
|
+
showAgeRatingRef.current?.();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
339
345
|
});
|
|
340
346
|
el.style.pointerEvents = controlsVisible ? "" : "none";
|
|
341
347
|
if (player) {
|
|
@@ -411,7 +417,7 @@ function Video({
|
|
|
411
417
|
if (!wrap) return;
|
|
412
418
|
if (ageRatingTlRef.current) ageRatingTlRef.current.kill();
|
|
413
419
|
const HOLD = 12;
|
|
414
|
-
const tl = gsap.timeline({ delay: 0.
|
|
420
|
+
const tl = gsap.timeline({ delay: 0.3 });
|
|
415
421
|
tl.fromTo(wrap, { opacity: 0 }, { opacity: 1, duration: 0.5, ease: "power2.out" });
|
|
416
422
|
if (icon) {
|
|
417
423
|
tl.fromTo(
|
|
@@ -430,7 +436,9 @@ function Video({
|
|
|
430
436
|
);
|
|
431
437
|
}
|
|
432
438
|
tl.to({}, { duration: HOLD });
|
|
433
|
-
tl.to(wrap, { opacity: 0, duration: 0.7, ease: "power2.inOut"
|
|
439
|
+
tl.to(wrap, { opacity: 0, duration: 0.7, ease: "power2.inOut", onComplete: () => {
|
|
440
|
+
ageRatingShownRef.current = true;
|
|
441
|
+
} });
|
|
434
442
|
ageRatingTlRef.current = tl;
|
|
435
443
|
};
|
|
436
444
|
showAgeRatingRef.current = showAgeRating;
|
|
@@ -440,10 +448,10 @@ function Video({
|
|
|
440
448
|
window.clearTimeout(ageRatingPauseTimerRef.current);
|
|
441
449
|
ageRatingPauseTimerRef.current = null;
|
|
442
450
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
451
|
+
const shouldShow = !ageRatingShownRef.current || ageRatingQueuedRef.current;
|
|
452
|
+
ageRatingQueuedRef.current = false;
|
|
453
|
+
if (shouldShow) ageRatingPendingRef.current = true;
|
|
454
|
+
setHasPlayed(true);
|
|
447
455
|
showControlsTemporarily();
|
|
448
456
|
};
|
|
449
457
|
const onPause = () => {
|
|
@@ -453,7 +461,7 @@ function Video({
|
|
|
453
461
|
if (parsed.ageRating?.data) {
|
|
454
462
|
if (ageRatingPauseTimerRef.current) window.clearTimeout(ageRatingPauseTimerRef.current);
|
|
455
463
|
ageRatingPauseTimerRef.current = window.setTimeout(() => {
|
|
456
|
-
|
|
464
|
+
ageRatingQueuedRef.current = true;
|
|
457
465
|
ageRatingPauseTimerRef.current = null;
|
|
458
466
|
}, 60 * 1e3);
|
|
459
467
|
}
|
|
@@ -2041,7 +2049,20 @@ function Video({
|
|
|
2041
2049
|
activeCue && /* @__PURE__ */ jsx(
|
|
2042
2050
|
"div",
|
|
2043
2051
|
{
|
|
2044
|
-
className:
|
|
2052
|
+
className: "pointer-events-none absolute inset-x-0 z-40 flex justify-center px-4",
|
|
2053
|
+
style: {
|
|
2054
|
+
bottom: (() => {
|
|
2055
|
+
if (preview) {
|
|
2056
|
+
const frameW = preview.cue.w ?? 160;
|
|
2057
|
+
const frameH = preview.cue.h ?? 90;
|
|
2058
|
+
const thumbH = Math.round(200 * (frameH / frameW));
|
|
2059
|
+
return `${80 + thumbH + 32 + 10}px`;
|
|
2060
|
+
}
|
|
2061
|
+
if (controlsVisible) return "5rem";
|
|
2062
|
+
return "1rem";
|
|
2063
|
+
})(),
|
|
2064
|
+
transition: "bottom 0.2s ease"
|
|
2065
|
+
},
|
|
2045
2066
|
children: /* @__PURE__ */ jsx(
|
|
2046
2067
|
"div",
|
|
2047
2068
|
{
|