Timeline seek hover preview always displays current playback frame instead of hovered timestamp
Description
When hovering over the video timeline seek bar on a Cap share page (e.g. /s/<videoId>), the seek tooltip popup displays:
- The chapter title corresponding to the hovered timestamp (e.g.
11:07) - The hovered time (
11:07) - Bug: The thumbnail image in the popup consistently displays the frame from the currently playing / paused position (e.g.
02:58), rather than the frame at the hovered time (11:07).
When scrubbing or hovering across the 20-minute timeline, the thumbnail image remains permanently frozen on whatever frame the main <video> is currently showing, creating a severe visual contradiction where the tooltip text describes one chapter while the image shows a completely unrelated earlier/later slide.
Steps to Reproduce
- Open any Cap video with chapters (or any standard recording), e.g.
https://cap.so/s/mdvxms2gfmkgc0e. - Pause playback at
02:58(which displays a specific slide, e.g. "The planet"). - Move the mouse cursor further down the progress bar and hover over
11:07(e.g. Chapter "Worker APIs, performance characteristics, and hierarchy recap"). - Inspect the tooltip popup above the seek bar:
- Chapter title: "Worker APIs, performance characteristics, and hierarchy recap" (at 11:07) ✅
- Timestamp: "11:07" ✅
- Actual thumbnail preview: Displays the slide from
02:58("The planet") ❌
Root Cause Analysis
In apps/web/app/s/[videoId]/_components/CapVideoPlayer.tsx (lines 636–651):
const thumbnailCacheRef = useRef<{ time: number; url: string } | null>(null);
const generateVideoFrameThumbnail = useCallback(
(_time: number): string | undefined => {
const video = videoRef.current;
if (!video) return undefined;
const cached = thumbnailCacheRef.current;
if (cached && Math.abs(cached.time - video.currentTime) < 0.25) {
return cached.url;
}
const url = captureVideoFrameDataUrl({ video });
if (url) {
thumbnailCacheRef.current = { time: video.currentTime, url };
}
return url;
},
[videoRef],
);
generateVideoFrameThumbnail accepts _time: number from MediaPlayerSeek, but ignores it entirely. It snapshots videoRef.current (which is at video.currentTime), meaning any hover anywhere across the timeline yields a duplicate capture of the live/paused frame.
(This pre-existing limitation was also noted during review in #1730).
Proposed Fix
- In
generateVideoFrameThumbnail: Validate hover proximity. Only snapshot the live<video>whenMath.abs(time - video.currentTime) <= 1.5(i.e. hovering right near the current playhead). - When hovering at distant timestamps or other chapters, return
undefinedsoMediaPlayerSeekgracefully displays the accurate Chapter title and timestamp without displaying a stale, mismatched frame (matching the clean behavior ofHLSVideoPlayer).