diff --git a/frontend/src/components/VideoPlayer.tsx b/frontend/src/components/VideoPlayer.tsx index f294c77f..d6c66c15 100644 --- a/frontend/src/components/VideoPlayer.tsx +++ b/frontend/src/components/VideoPlayer.tsx @@ -112,6 +112,7 @@ type VideoPlayerProps = { onWatchStateChanged?: (status: boolean) => void; onVideoEnd?: () => void; seekToTimestamp?: number; + setSeekToTimestamp?: (timestamp: number | undefined) => void; }; const VideoPlayer = ({ @@ -122,6 +123,7 @@ const VideoPlayer = ({ onWatchStateChanged, onVideoEnd, seekToTimestamp, + setSeekToTimestamp, }: VideoPlayerProps) => { const videoRef = useRef(null); @@ -140,6 +142,8 @@ const VideoPlayer = ({ if (videoRef.current.paused) { videoRef.current.play(); } + if (setSeekToTimestamp) setSeekToTimestamp(undefined); + window.scroll(0, 0); }, [seekToTimestamp]); const [searchParams] = useSearchParams(); diff --git a/frontend/src/pages/Video.tsx b/frontend/src/pages/Video.tsx index 9607d4ff..93c211b0 100644 --- a/frontend/src/pages/Video.tsx +++ b/frontend/src/pages/Video.tsx @@ -138,9 +138,6 @@ const Video = () => { const handleTimestampClick = (seconds: number) => { setSeekToTimestamp(seconds); - - // Reset timestamp to allow clicking again - setTimeout(() => setSeekToTimestamp(undefined), 500); }; useEffect(() => { @@ -233,6 +230,7 @@ const Video = () => { sponsorBlock={sponsorBlock} autoplay={playlistAutoplay} seekToTimestamp={seekToTimestamp} + setSeekToTimestamp={setSeekToTimestamp} onWatchStateChanged={() => { setRefreshVideoList(true); }}