@cliff-studio/sanity-plugin-bunny-input 1.0.5 → 1.0.7
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
|
@@ -18603,18 +18603,23 @@ function BunnyInput(props) {
|
|
|
18603
18603
|
useEffect(() => (value?.videoId && value?.status === "processing" && (pollIntervalRef.current = window.setInterval(async () => {
|
|
18604
18604
|
try {
|
|
18605
18605
|
const videoData = await getVideo(config, value.videoId), status = mapBunnyStatus(videoData.status);
|
|
18606
|
-
(status === "ready" || status === "error")
|
|
18607
|
-
|
|
18608
|
-
|
|
18609
|
-
|
|
18610
|
-
|
|
18611
|
-
|
|
18612
|
-
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18616
|
-
|
|
18617
|
-
|
|
18606
|
+
if (status === "ready" || status === "error") {
|
|
18607
|
+
pollIntervalRef.current && (clearInterval(pollIntervalRef.current), pollIntervalRef.current = null);
|
|
18608
|
+
const width = Number(videoData.width), height = Number(videoData.height), hasDims = Number.isFinite(width) && Number.isFinite(height) && width > 0 && height > 0, ratio = hasDims ? Number((width / height).toFixed(6)) : null;
|
|
18609
|
+
onChange(
|
|
18610
|
+
set({
|
|
18611
|
+
...value,
|
|
18612
|
+
status,
|
|
18613
|
+
duration: videoData.length,
|
|
18614
|
+
height: hasDims ? height : null,
|
|
18615
|
+
width: hasDims ? width : null,
|
|
18616
|
+
ratio,
|
|
18617
|
+
thumbnailUrl: getThumbnailUrl(config.cdnHostname, value.videoId),
|
|
18618
|
+
playbackUrl: getPlaybackUrl(config.cdnHostname, value.videoId),
|
|
18619
|
+
mp4Url: getMp4Url(config.cdnHostname, value.videoId)
|
|
18620
|
+
})
|
|
18621
|
+
);
|
|
18622
|
+
}
|
|
18618
18623
|
} catch (err) {
|
|
18619
18624
|
console.error("Error polling video status:", err);
|
|
18620
18625
|
}
|
|
@@ -18941,6 +18946,12 @@ const createBunnyVideoSchema = (config) => defineType({
|
|
|
18941
18946
|
name: "height",
|
|
18942
18947
|
readOnly: !0
|
|
18943
18948
|
}),
|
|
18949
|
+
defineField({
|
|
18950
|
+
type: "number",
|
|
18951
|
+
title: "Video ratio",
|
|
18952
|
+
name: "ratio",
|
|
18953
|
+
readOnly: !0
|
|
18954
|
+
}),
|
|
18944
18955
|
defineField({
|
|
18945
18956
|
type: "string",
|
|
18946
18957
|
title: "Thumbnail URL",
|