From 9ac36711a7a61150025ad103c3948691e51a7b0d Mon Sep 17 00:00:00 2001 From: C043 Date: Fri, 23 May 2025 12:31:41 +0200 Subject: [PATCH] Moved setLoading call inside the processVideo fucntion --- src/pages/tools/video/change-speed/index.tsx | 33 ++++++++++---------- src/pages/tools/video/change-speed/types.ts | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/pages/tools/video/change-speed/index.tsx b/src/pages/tools/video/change-speed/index.tsx index 2428140..15e6551 100644 --- a/src/pages/tools/video/change-speed/index.tsx +++ b/src/pages/tools/video/change-speed/index.tsx @@ -25,7 +25,6 @@ export default function ChangeSpeed({ const [loading, setLoading] = useState(false); const compute = (optionsValues: InitialValuesType, input: File | null) => { - setLoading(true); if (!input) return; const { newSpeed } = optionsValues; let ffmpeg: FFmpeg | null = null; @@ -35,6 +34,8 @@ export default function ChangeSpeed({ file: File, newSpeed: number ): Promise => { + setLoading(true); + if (!ffmpeg) { ffmpeg = new FFmpeg(); } @@ -124,27 +125,27 @@ export default function ChangeSpeed({ }; // Here we set the output video - setResult(main(input, optionsValues)); + processVideo(input, newSpeed) }; const getGroups: GetGroupsType | null = ({ values, updateField }) => [ - { - title: 'New Video Speed', - component: ( - - updateField('newSpeed', Number(val))} - description="Default multiplier: 2 means 2x faster" - type="number" - /> - - ) - } - ]; + { + title: 'New Video Speed', + component: ( + + updateField('newSpeed', Number(val))} + description="Default multiplier: 2 means 2x faster" + type="number" + /> + + ) + } + ]; return (