diff --git a/apps/client/src/widgets/type_widgets/file/Video.tsx b/apps/client/src/widgets/type_widgets/file/Video.tsx index b795699086..a950f6ab42 100644 --- a/apps/client/src/widgets/type_widgets/file/Video.tsx +++ b/apps/client/src/widgets/type_widgets/file/Video.tsx @@ -55,23 +55,6 @@ export default function VideoPreview({ note }: { note: FNote }) { }); }, [playing]); - const togglePlayback = () => { - const video = videoRef.current; - if (!video) return; - - if (video.paused) { - video.play(); - } else { - video.pause(); - } - }; - - const skip = (seconds: number) => { - const video = videoRef.current; - if (!video) return; - video.currentTime = Math.max(0, Math.min(video.duration, video.currentTime + seconds)); - }; - return (
- skip(-10)} - /> - - skip(30)} - /> + + +
@@ -117,6 +87,40 @@ export default function VideoPreview({ note }: { note: FNote }) { ); } +function PlayPauseButton({ videoRef, playing }: { videoRef: RefObject, playing: boolean }) { + const togglePlayback = () => { + const video = videoRef.current; + if (!video) return; + + if (video.paused) { + video.play(); + } else { + video.pause(); + } + }; + + return ( + + ); +} + +function SkipButton({ videoRef, seconds, icon, text }: { videoRef: RefObject, seconds: number, icon: string, text: string }) { + const skip = () => { + const video = videoRef.current; + if (!video) return; + video.currentTime = Math.max(0, Math.min(video.duration, video.currentTime + seconds)); + }; + + return ( + + ); +} + function SeekBar({ videoRef }: { videoRef: RefObject }) { const [currentTime, setCurrentTime] = useState(0); const [duration, setDuration] = useState(0);