From 6c0edcb7b74608e43cdfc3dde03c6e17a251ce90 Mon Sep 17 00:00:00 2001 From: sagar kothari Date: Tue, 7 May 2024 05:15:38 +0530 Subject: [PATCH] bug fix for video duration --- src/common/components/video-upload-threespeak/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/components/video-upload-threespeak/index.tsx b/src/common/components/video-upload-threespeak/index.tsx index a273692f906..a9f7a849aa6 100644 --- a/src/common/components/video-upload-threespeak/index.tsx +++ b/src/common/components/video-upload-threespeak/index.tsx @@ -46,6 +46,7 @@ export const VideoUpload = (props: Props & React.HTMLAttributes) const [videoUrl, setVideoUrl] = useState(""); const [thumbUrl, setThumbUrl] = useState(""); const [duration, setDuration] = useState(""); + const [durationForApiCall, setDurationForApiCall] = useState(0); const [showRecorder, setShowRecorder] = useState(false); const canUpload = videoUrl; @@ -68,6 +69,7 @@ export const VideoUpload = (props: Props & React.HTMLAttributes) setVideoPercentage(0); setThumbnailPercentage(0); setShowRecorder(false); + setDurationForApiCall(0); } }, [props.show]); @@ -78,6 +80,7 @@ export const VideoUpload = (props: Props & React.HTMLAttributes) const seconds = Math.floor(duration % 60); const videoDuration = `${minutes}:${seconds}`; setDuration(videoDuration); + setDurationForApiCall(duration); } }; @@ -205,7 +208,7 @@ export const VideoUpload = (props: Props & React.HTMLAttributes) videoUrl, thumbUrl, activeUser: activeUser!.username, - duration + duration: durationForApiCall, }); props.setShow(false); setStep("upload");