@geekapps/silo-elements-nextjs 0.2.54 → 0.2.56
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/VideoPlayer.d.ts +13 -1
- package/dist/VideoPlayer.js +47 -2
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +47 -2
- 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/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { ImageUploader } from './ImageUploader.js';
|
|
|
2
2
|
export { VideoUploader } from './VideoUploader.js';
|
|
3
3
|
export { FileUploader } from './FileUploader.js';
|
|
4
4
|
export { MediaUploader } from './MediaUploader.js';
|
|
5
|
-
export { Captions, CaptionsProps, Source, SourceProps, Storyboard, StoryboardFrame, StoryboardFrameProps, StoryboardProps, Video, VideoPlayer, VideoSourceType, VideoThumbnail, ThumbnailProps as VideoThumbnailProps } from './VideoPlayer.js';
|
|
5
|
+
export { Captions, CaptionsProps, Chapters, ChaptersProps, Source, SourceProps, Storyboard, StoryboardFrame, StoryboardFrameProps, StoryboardProps, Video, VideoPlayer, VideoSourceType, VideoThumbnail, ThumbnailProps as VideoThumbnailProps } from './VideoPlayer.js';
|
|
6
6
|
export { DropZone } from './components/DropZone.js';
|
|
7
7
|
export { ProgressBar } from './components/ProgressBar.js';
|
|
8
8
|
import * as react from 'react';
|
package/dist/index.js
CHANGED
|
@@ -1144,6 +1144,10 @@ function Captions(_props) {
|
|
|
1144
1144
|
return null;
|
|
1145
1145
|
}
|
|
1146
1146
|
Captions.displayName = "SiloCaptions";
|
|
1147
|
+
function Chapters(_props) {
|
|
1148
|
+
return null;
|
|
1149
|
+
}
|
|
1150
|
+
Chapters.displayName = "SiloChapters";
|
|
1147
1151
|
function VideoThumbnail(_props) {
|
|
1148
1152
|
return null;
|
|
1149
1153
|
}
|
|
@@ -1168,6 +1172,7 @@ function Video({
|
|
|
1168
1172
|
}) {
|
|
1169
1173
|
const parsed = useMemo(() => parseVideoChildren(children), [children]);
|
|
1170
1174
|
const [captions, setCaptions] = useState([]);
|
|
1175
|
+
const [chapters, setChapters] = useState([]);
|
|
1171
1176
|
const [poster, setPoster] = useState(void 0);
|
|
1172
1177
|
const captionsSourceRef = useRef("");
|
|
1173
1178
|
useEffect(() => {
|
|
@@ -1202,6 +1207,25 @@ function Video({
|
|
|
1202
1207
|
cancelled = true;
|
|
1203
1208
|
};
|
|
1204
1209
|
}, [parsed.captionsSrc, parsed.captionsData]);
|
|
1210
|
+
useEffect(() => {
|
|
1211
|
+
if (parsed.chaptersData) {
|
|
1212
|
+
setChapters(parsed.chaptersData);
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
if (!parsed.chaptersSrc) {
|
|
1216
|
+
setChapters([]);
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
let cancelled = false;
|
|
1220
|
+
fetch(parsed.chaptersSrc, { cache: "no-store" }).then((r) => r.json()).then((data) => {
|
|
1221
|
+
if (!cancelled && Array.isArray(data)) setChapters(data);
|
|
1222
|
+
}).catch(() => {
|
|
1223
|
+
if (!cancelled) setChapters([]);
|
|
1224
|
+
});
|
|
1225
|
+
return () => {
|
|
1226
|
+
cancelled = true;
|
|
1227
|
+
};
|
|
1228
|
+
}, [parsed.chaptersSrc, parsed.chaptersData]);
|
|
1205
1229
|
useEffect(() => {
|
|
1206
1230
|
if (!parsed.thumbnailSrc) {
|
|
1207
1231
|
setPoster(void 0);
|
|
@@ -2608,6 +2632,14 @@ function Video({
|
|
|
2608
2632
|
}
|
|
2609
2633
|
}
|
|
2610
2634
|
),
|
|
2635
|
+
chapters.length > 0 && duration > 0 && chapters.map((ch, i) => /* @__PURE__ */ jsx(
|
|
2636
|
+
"div",
|
|
2637
|
+
{
|
|
2638
|
+
className: "pointer-events-none absolute top-1/2 -translate-y-1/2 w-0.5 rounded-full bg-white/50",
|
|
2639
|
+
style: { left: `${ch.startTime / duration * 100}%`, height: isDragging ? "7px" : isHoveringProgress ? "5px" : "3px", transition: "height 0.15s ease" }
|
|
2640
|
+
},
|
|
2641
|
+
i
|
|
2642
|
+
)),
|
|
2611
2643
|
preview && (() => {
|
|
2612
2644
|
const frameW = preview.cue.w ?? 160;
|
|
2613
2645
|
const frameH = preview.cue.h ?? 90;
|
|
@@ -2700,7 +2732,12 @@ function Video({
|
|
|
2700
2732
|
formatTime(currentTime),
|
|
2701
2733
|
/* @__PURE__ */ jsx("span", { className: "text-white/30", children: "/" }),
|
|
2702
2734
|
/* @__PURE__ */ jsx("span", { className: "text-white/45", children: formatTime(duration) })
|
|
2703
|
-
] })
|
|
2735
|
+
] }),
|
|
2736
|
+
(() => {
|
|
2737
|
+
if (chapters.length === 0) return null;
|
|
2738
|
+
const ch = [...chapters].reverse().find((c) => currentTime >= c.startTime);
|
|
2739
|
+
return ch ? /* @__PURE__ */ jsx("span", { className: "hidden max-w-40 truncate text-[11px] text-white/50 @sm:block", children: ch.title }) : null;
|
|
2740
|
+
})()
|
|
2704
2741
|
] }),
|
|
2705
2742
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 @sm:gap-1", children: [
|
|
2706
2743
|
/* @__PURE__ */ jsx(
|
|
@@ -2916,6 +2953,14 @@ function parseVideoChildren(children) {
|
|
|
2916
2953
|
parsed.captionsSrc = element.props.src;
|
|
2917
2954
|
}
|
|
2918
2955
|
}
|
|
2956
|
+
if (child.type === Chapters || name === "SiloChapters") {
|
|
2957
|
+
const element = child;
|
|
2958
|
+
if (element.props.data) {
|
|
2959
|
+
parsed.chaptersData = element.props.data;
|
|
2960
|
+
} else if (element.props.src) {
|
|
2961
|
+
parsed.chaptersSrc = element.props.src;
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2919
2964
|
if (child.type === VideoThumbnail || name === "SiloVideoThumbnail") {
|
|
2920
2965
|
const element = child;
|
|
2921
2966
|
parsed.thumbnailSrc = element.props.src;
|
|
@@ -3480,6 +3525,6 @@ function Badge({ children, muted }) {
|
|
|
3480
3525
|
);
|
|
3481
3526
|
}
|
|
3482
3527
|
|
|
3483
|
-
export { Avatar, Background, Captions, DropZone, FileCard, FileIcon, FilePreview, FileUploader, ImageOptions, ImageUploader, MediaUploader, ProgressBar, Source, Storyboard, StoryboardFrame, Thumbnail, Video, VideoOptions, VideoPlayer, VideoThumbnail, VideoUploader, defaultTheme, resolveTheme };
|
|
3528
|
+
export { Avatar, Background, Captions, Chapters, DropZone, FileCard, FileIcon, FilePreview, FileUploader, ImageOptions, ImageUploader, MediaUploader, ProgressBar, Source, Storyboard, StoryboardFrame, Thumbnail, Video, VideoOptions, VideoPlayer, VideoThumbnail, VideoUploader, defaultTheme, resolveTheme };
|
|
3484
3529
|
//# sourceMappingURL=index.js.map
|
|
3485
3530
|
//# sourceMappingURL=index.js.map
|