1
0
mirror of https://github.com/mifi/lossless-cut.git synced 2024-11-22 02:12:30 +01:00

fix types

This commit is contained in:
Mikael Finstad 2024-08-06 00:54:20 +02:00
parent fbd57b625b
commit 94df449d12
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

View File

@ -297,7 +297,7 @@ function App() {
if (videoRef.current) videoRef.current.volume = playbackVolume; if (videoRef.current) videoRef.current.volume = playbackVolume;
}, [playbackVolume]); }, [playbackVolume]);
const seekAbs = useCallback((val) => { const seekAbs = useCallback((val: number | undefined) => {
const video = videoRef.current; const video = videoRef.current;
if (video == null || val == null || Number.isNaN(val)) return; if (video == null || val == null || Number.isNaN(val)) return;
let outVal = val; let outVal = val;
@ -438,19 +438,20 @@ function App() {
userSeekAbs(videoRef.current!.currentTime + val); userSeekAbs(videoRef.current!.currentTime + val);
}, [userSeekAbs]); }, [userSeekAbs]);
const seekRelPercent = useCallback((val) => { const seekRelPercent = useCallback((val: number) => {
if (!isDurationValid(zoomedDuration)) return; if (!isDurationValid(zoomedDuration)) return;
seekRel(val * zoomedDuration); seekRel(val * zoomedDuration);
}, [seekRel, zoomedDuration]); }, [seekRel, zoomedDuration]);
const onTimelineWheel = useTimelineScroll({ wheelSensitivity, mouseWheelZoomModifierKey, invertTimelineScroll, zoomRel, seekRel }); const onTimelineWheel = useTimelineScroll({ wheelSensitivity, mouseWheelZoomModifierKey, invertTimelineScroll, zoomRel, seekRel });
const shortStep = useCallback((direction) => { const shortStep = useCallback((direction: number) => {
// If we don't know fps, just assume 30 (for example if unknown audio file) // If we don't know fps, just assume 30 (for example if unknown audio file)
const fps = detectedFps || 30; const fps = detectedFps || 30;
// try to align with frame // try to align with frame
const currentTimeNearestFrameNumber = getFrameCountRaw(fps, videoRef.current!.currentTime); const currentTimeNearestFrameNumber = getFrameCountRaw(fps, videoRef.current!.currentTime);
invariant(currentTimeNearestFrameNumber != null);
const nextFrame = currentTimeNearestFrameNumber + direction; const nextFrame = currentTimeNearestFrameNumber + direction;
userSeekAbs(nextFrame / fps); userSeekAbs(nextFrame / fps);
}, [detectedFps, userSeekAbs]); }, [detectedFps, userSeekAbs]);