'use client'; import { useRef } from 'react'; import type { MediaPlayerInstance } from '@vidstack/react'; import { Film } from 'lucide-react'; import { useProtectedVideoQuery } from '@/app/(modules)/results/hooks/useVideoResults'; import type { CompletedVideoResult } from '@/types'; import DetectionLocationMap from './map/detectionLocationMap'; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from './ui/card'; import AnnotatedDetectionImage from './video/annotatedDetectionImage'; import AnnotatedVideoPlayer from './video/annotatedVideoPlayer'; import CurrentDetectionBar from './video/currentDetectionBar'; import DetectionLogs from './video/detectionLogs'; import ResultStatsGrid from './video/resultStatsGrid'; import { useVideoAnnotationPlayback } from './video/useVideoAnnotationPlayback'; type VideoPlayerSectionProps = { data: CompletedVideoResult; }; export default function VideoPlayerSection({ data }: VideoPlayerSectionProps) { const videoRef = useRef(null); const { activeLog, handleSeek, handleSeeked, handleTimeUpdate, handleVideoFrame, sortedLogs, visibleDetections, } = useVideoAnnotationPlayback({ videoId: data.video_id, logs: data.logs, fps: data.summary.fps, videoRef, }); const { videoUrl, isLoading: isVideoLoading, isError: isVideoError, refetch: refetchVideo, } = useProtectedVideoQuery(data.raw_video_url); const mediaAspectRatio = data.summary.video_width > 0 && data.summary.video_height > 0 ? `${data.summary.video_width} / ${data.summary.video_height}` : '16 / 9'; const activeMapLabel = activeLog ? `${activeLog.detection.display_name} - Frame ${activeLog.frame.number}` : 'Detection'; return (
Detection Playback Raw video with frontend annotation overlay and selected detection location

Detection Video

void refetchVideo()} onTimeUpdate={handleTimeUpdate} onVideoFrame={handleVideoFrame} onSeeked={handleSeeked} />

Annotated Image

); }