pull/2514/head
Mikael Finstad 11 months ago
parent 87ed716415
commit 2508079915
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -395,11 +395,13 @@ function App() {
}, [seekRel, zoomedDuration]);
const shortStep = useCallback((direction: number) => {
if (!videoRef.current) return;
// If we don't know fps, just assume 30 (for example if unknown audio file)
const fps = detectedFps || 30;
// 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;
seekAbs(nextFrame / fps);

@ -83,8 +83,8 @@ export default ({ filePath }: { filePath: string | undefined }) => {
const onPlayingChange = useCallback((val: boolean) => {
playingRef.current = val;
setPlaying(val);
if (!val) {
setCommandedTime(videoRef.current!.currentTime);
if (!val && videoRef.current) {
setCommandedTime(videoRef.current.currentTime);
}
}, [setCommandedTime]);
@ -101,7 +101,7 @@ export default ({ filePath }: { filePath: string | undefined }) => {
const pause = useCallback(() => {
if (!filePath || !playingRef.current) return;
videoRef.current!.pause();
videoRef.current?.pause();
}, [filePath, playingRef, videoRef]);
const play = useCallback((resetPlaybackRate?: boolean) => {

Loading…
Cancel
Save