@cliff-studio/sanity-plugin-bunny-input 1.0.2 → 1.0.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/_chunks-es/index.js
CHANGED
|
@@ -18602,12 +18602,16 @@ function BunnyInput(props) {
|
|
|
18602
18602
|
const { value, onChange, config } = props, [uploadProgress, setUploadProgress] = useState(0), [isUploading, setIsUploading] = useState(!1), [error, setError] = useState(null), fileInputRef = useRef(null), pollIntervalRef = useRef(null);
|
|
18603
18603
|
useEffect(() => (value?.videoId && value?.status === "processing" && (pollIntervalRef.current = window.setInterval(async () => {
|
|
18604
18604
|
try {
|
|
18605
|
-
const videoData = await getVideo(config, value.videoId)
|
|
18605
|
+
const videoData = await getVideo(config, value.videoId);
|
|
18606
|
+
console.log("[bunny] getVideo response", JSON.stringify(videoData, null, 2));
|
|
18607
|
+
const status = mapBunnyStatus(videoData.status);
|
|
18606
18608
|
(status === "ready" || status === "error") && (pollIntervalRef.current && (clearInterval(pollIntervalRef.current), pollIntervalRef.current = null), onChange(
|
|
18607
18609
|
set({
|
|
18608
18610
|
...value,
|
|
18609
18611
|
status,
|
|
18610
18612
|
duration: videoData.length,
|
|
18613
|
+
videoHeight: videoData.height ?? null,
|
|
18614
|
+
videoWidth: videoData.width ?? null,
|
|
18611
18615
|
thumbnailUrl: getThumbnailUrl(config.cdnHostname, value.videoId),
|
|
18612
18616
|
playbackUrl: getPlaybackUrl(config.cdnHostname, value.videoId),
|
|
18613
18617
|
mp4Url: getMp4Url(config.cdnHostname, value.videoId)
|
|
@@ -18904,7 +18908,7 @@ const createBunnyVideoSchema = (config) => defineType({
|
|
|
18904
18908
|
}),
|
|
18905
18909
|
defineField({
|
|
18906
18910
|
type: "string",
|
|
18907
|
-
title: "Collection
|
|
18911
|
+
title: "Collection name",
|
|
18908
18912
|
name: "collectionName",
|
|
18909
18913
|
readOnly: !0
|
|
18910
18914
|
}),
|
|
@@ -18927,6 +18931,18 @@ const createBunnyVideoSchema = (config) => defineType({
|
|
|
18927
18931
|
},
|
|
18928
18932
|
readOnly: !0
|
|
18929
18933
|
}),
|
|
18934
|
+
defineField({
|
|
18935
|
+
type: "number",
|
|
18936
|
+
title: "Video width",
|
|
18937
|
+
name: "videoWidth",
|
|
18938
|
+
readOnly: !0
|
|
18939
|
+
}),
|
|
18940
|
+
defineField({
|
|
18941
|
+
type: "number",
|
|
18942
|
+
title: "Video height",
|
|
18943
|
+
name: "videoHeight",
|
|
18944
|
+
readOnly: !0
|
|
18945
|
+
}),
|
|
18930
18946
|
defineField({
|
|
18931
18947
|
type: "string",
|
|
18932
18948
|
title: "Thumbnail URL",
|