Cap icon indicating copy to clipboard operation
Cap copied to clipboard

Timeline seek hover preview always displays current playback frame instead of hovered timestamp

Open ghazy2001 opened this issue 1 month ago • 1 comments

Description

When hovering over the video timeline seek bar on a Cap share page (e.g. /s/<videoId>), the seek tooltip popup displays:

  1. The chapter title corresponding to the hovered timestamp (e.g. 11:07)
  2. The hovered time (11:07)
  3. 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

  1. Open any Cap video with chapters (or any standard recording), e.g. https://cap.so/s/mdvxms2gfmkgc0e.
  2. Pause playback at 02:58 (which displays a specific slide, e.g. "The planet").
  3. Move the mouse cursor further down the progress bar and hover over 11:07 (e.g. Chapter "Worker APIs, performance characteristics, and hierarchy recap").
  4. 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

  1. In generateVideoFrameThumbnail: Validate hover proximity. Only snapshot the live <video> when Math.abs(time - video.currentTime) <= 1.5 (i.e. hovering right near the current playhead).
  2. When hovering at distant timestamps or other chapters, return undefined so MediaPlayerSeek gracefully displays the accurate Chapter title and timestamp without displaying a stale, mismatched frame (matching the clean behavior of HLSVideoPlayer).

ghazy2001 avatar Oct 22 '26 16:10 ghazy2001

CAP-880

linear[bot] avatar Oct 22 '26 16:10 linear[bot]