mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 05:59:34 +02:00
fix: misc
This commit is contained in:
@@ -41,7 +41,7 @@ export default function BaseFileInput({
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error previewing file:', error);
|
console.error('Error previewing file:', error);
|
||||||
}
|
}
|
||||||
}
|
} else setPreview(null);
|
||||||
}, [value]);
|
}, [value]);
|
||||||
|
|
||||||
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
@@ -67,11 +67,6 @@ export default function BaseFileInput({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleClear() {
|
|
||||||
// @ts-ignore
|
|
||||||
onChange(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleDrop = (event: React.DragEvent<HTMLDivElement>) => {
|
const handleDrop = (event: React.DragEvent<HTMLDivElement>) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -213,11 +208,7 @@ export default function BaseFileInput({
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
<InputFooter
|
<InputFooter handleCopy={handleCopy} handleImport={handleImportClick} />
|
||||||
handleCopy={handleCopy}
|
|
||||||
handleImport={handleImportClick}
|
|
||||||
handleClear={handleClear}
|
|
||||||
/>
|
|
||||||
<input
|
<input
|
||||||
ref={fileInputRef}
|
ref={fileInputRef}
|
||||||
style={{ display: 'none' }}
|
style={{ display: 'none' }}
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable prettier/prettier */
|
|
||||||
import { Box } from '@mui/material';
|
import { Box } from '@mui/material';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import ToolContent from '@components/ToolContent';
|
import ToolContent from '@components/ToolContent';
|
||||||
@@ -23,14 +22,14 @@ export default function ChangeSpeed({
|
|||||||
const [result, setResult] = useState<File | null>(null);
|
const [result, setResult] = useState<File | null>(null);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
// FFmpeg only supports atempo between 0.5 and 2.0, so we chain filters
|
// FFmpeg only supports a tempo between 0.5 and 2.0, so we chain filters
|
||||||
const computeAudioFilter = (speed: number): string => {
|
const computeAudioFilter = (speed: number): string => {
|
||||||
if (speed <= 2 && speed >= 0.5) {
|
if (speed <= 2 && speed >= 0.5) {
|
||||||
return `atempo=${speed}`;
|
return `atempo=${speed}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Break into supported chunks
|
// Break into supported chunks
|
||||||
const filters = [];
|
const filters: string[] = [];
|
||||||
let remainingSpeed = speed;
|
let remainingSpeed = speed;
|
||||||
while (remainingSpeed > 2.0) {
|
while (remainingSpeed > 2.0) {
|
||||||
filters.push('atempo=2.0');
|
filters.push('atempo=2.0');
|
||||||
@@ -55,6 +54,7 @@ export default function ChangeSpeed({
|
|||||||
file: File,
|
file: File,
|
||||||
newSpeed: number
|
newSpeed: number
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
|
if (newSpeed === 0) return;
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
if (!ffmpeg) {
|
if (!ffmpeg) {
|
||||||
|
@@ -7,7 +7,7 @@ export const tool = defineTool('video', {
|
|||||||
icon: 'material-symbols-light:speed-outline',
|
icon: 'material-symbols-light:speed-outline',
|
||||||
description:
|
description:
|
||||||
'This online utility lets you change the speed of a video. You can speed it up or slow it down.',
|
'This online utility lets you change the speed of a video. You can speed it up or slow it down.',
|
||||||
shortDescription: 'Quickly change VIDEO speed',
|
shortDescription: 'Quickly change video speed',
|
||||||
keywords: ['change', 'speed'],
|
keywords: ['change', 'speed'],
|
||||||
component: lazy(() => import('./index'))
|
component: lazy(() => import('./index'))
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user