@cliff-studio/sanity-plugin-bunny-input 1.0.4 → 1.0.5
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,16 +18602,14 @@ 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);
|
|
18606
|
-
console.log("[bunny] getVideo response", JSON.stringify(videoData, null, 2));
|
|
18607
|
-
const status = mapBunnyStatus(videoData.status);
|
|
18605
|
+
const videoData = await getVideo(config, value.videoId), status = mapBunnyStatus(videoData.status);
|
|
18608
18606
|
(status === "ready" || status === "error") && (pollIntervalRef.current && (clearInterval(pollIntervalRef.current), pollIntervalRef.current = null), onChange(
|
|
18609
18607
|
set({
|
|
18610
18608
|
...value,
|
|
18611
18609
|
status,
|
|
18612
18610
|
duration: videoData.length,
|
|
18613
|
-
|
|
18614
|
-
|
|
18611
|
+
height: videoData.height ?? null,
|
|
18612
|
+
width: videoData.width ?? null,
|
|
18615
18613
|
thumbnailUrl: getThumbnailUrl(config.cdnHostname, value.videoId),
|
|
18616
18614
|
playbackUrl: getPlaybackUrl(config.cdnHostname, value.videoId),
|
|
18617
18615
|
mp4Url: getMp4Url(config.cdnHostname, value.videoId)
|
|
@@ -18934,13 +18932,13 @@ const createBunnyVideoSchema = (config) => defineType({
|
|
|
18934
18932
|
defineField({
|
|
18935
18933
|
type: "number",
|
|
18936
18934
|
title: "Video width",
|
|
18937
|
-
name: "
|
|
18935
|
+
name: "width",
|
|
18938
18936
|
readOnly: !0
|
|
18939
18937
|
}),
|
|
18940
18938
|
defineField({
|
|
18941
18939
|
type: "number",
|
|
18942
18940
|
title: "Video height",
|
|
18943
|
-
name: "
|
|
18941
|
+
name: "height",
|
|
18944
18942
|
readOnly: !0
|
|
18945
18943
|
}),
|
|
18946
18944
|
defineField({
|