mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-20 14:39:34 +02:00
Moved setLoading call inside the processVideo fucntion
This commit is contained in:
@@ -25,7 +25,6 @@ export default function ChangeSpeed({
|
|||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const compute = (optionsValues: InitialValuesType, input: File | null) => {
|
const compute = (optionsValues: InitialValuesType, input: File | null) => {
|
||||||
setLoading(true);
|
|
||||||
if (!input) return;
|
if (!input) return;
|
||||||
const { newSpeed } = optionsValues;
|
const { newSpeed } = optionsValues;
|
||||||
let ffmpeg: FFmpeg | null = null;
|
let ffmpeg: FFmpeg | null = null;
|
||||||
@@ -35,6 +34,8 @@ export default function ChangeSpeed({
|
|||||||
file: File,
|
file: File,
|
||||||
newSpeed: number
|
newSpeed: number
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
|
setLoading(true);
|
||||||
|
|
||||||
if (!ffmpeg) {
|
if (!ffmpeg) {
|
||||||
ffmpeg = new FFmpeg();
|
ffmpeg = new FFmpeg();
|
||||||
}
|
}
|
||||||
@@ -124,27 +125,27 @@ export default function ChangeSpeed({
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Here we set the output video
|
// Here we set the output video
|
||||||
setResult(main(input, optionsValues));
|
processVideo(input, newSpeed)
|
||||||
};
|
};
|
||||||
|
|
||||||
const getGroups: GetGroupsType<InitialValuesType> | null = ({
|
const getGroups: GetGroupsType<InitialValuesType> | null = ({
|
||||||
values,
|
values,
|
||||||
updateField
|
updateField
|
||||||
}) => [
|
}) => [
|
||||||
{
|
{
|
||||||
title: 'New Video Speed',
|
title: 'New Video Speed',
|
||||||
component: (
|
component: (
|
||||||
<Box>
|
<Box>
|
||||||
<TextFieldWithDesc
|
<TextFieldWithDesc
|
||||||
value={values.newSpeed.toString()}
|
value={values.newSpeed.toString()}
|
||||||
onOwnChange={(val) => updateField('newSpeed', Number(val))}
|
onOwnChange={(val) => updateField('newSpeed', Number(val))}
|
||||||
description="Default multiplier: 2 means 2x faster"
|
description="Default multiplier: 2 means 2x faster"
|
||||||
type="number"
|
type="number"
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
return (
|
return (
|
||||||
<ToolContent
|
<ToolContent
|
||||||
title={title}
|
title={title}
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
export type InitialValuesType = {
|
export type InitialValuesType = {
|
||||||
newSpeed: Number;
|
newSpeed: number;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user