diff --git a/src/app/(modules)/results/hooks/useVideoResults.ts b/src/app/(modules)/results/hooks/useVideoResults.ts index cbde463..7c74af9 100644 --- a/src/app/(modules)/results/hooks/useVideoResults.ts +++ b/src/app/(modules)/results/hooks/useVideoResults.ts @@ -4,6 +4,7 @@ import { useEffect, useState } from 'react'; import { useQuery } from '@tanstack/react-query'; import { videoService } from '@/services/api'; +import type { VideoAnnotationFramesParams } from '@/types'; import { videoKeys } from '../queries/videoKeys'; @@ -18,6 +19,20 @@ export function useVideoResultsQuery(videoId: string | undefined) { }); } +export function useVideoAnnotationFramesQuery( + videoId: string | undefined, + params: VideoAnnotationFramesParams, +) { + return useQuery({ + queryKey: videoKeys.annotationFrames(videoId ?? '', params), + queryFn: () => + videoService.getVideoAnnotationFrames(videoId as string, params), + enabled: Boolean(videoId), + staleTime: 1000 * 60 * 5, + gcTime: 1000 * 60 * 30, + }); +} + /** * Download the annotated video through the authenticated axios client and * expose a local object URL that the native `