File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
routes/datasets/[dataset_id]/videos/[sample_id] Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 2121 let frames = $state <FrameView []>(video .frame == null ? [] : [video .frame ]);
2222
2323 async function handleMouseEnter() {
24- await loadFrames (0 );
24+ await loadFrames (1 );
2525 if (videoEl ) {
2626 // Check if the video has enough data
2727 if (videoEl .readyState < 2 ) {
5555 }
5656
5757 async function loadFrames(cursor : number ) {
58- let framesWithAnnotations = await getAllFrames ({
58+ let videoFrames = await getAllFrames ({
5959 path: {
6060 video_frame_dataset_id: (video .frame ?.sample as SampleView ).dataset_id
6161 },
6565 limit: 25
6666 }
6767 });
68- frames = [... frames , ... (framesWithAnnotations ?.data ?.data ?? [])];
68+
69+ frames = [... frames , ... (videoFrames ?.data ?.data ?? [])];
6970 }
7071 </script >
7172
Original file line number Diff line number Diff line change 2424 let containerEl: HTMLDivElement | null = null ;
2525 let overlaySize = $state (0 );
2626 let overlayHeight = $state (0 );
27+ let currentIndex = 0 ;
2728
2829 $effect (() => {
2930 if (containerEl ) {
3435
3536 function onUpdate(frame : FrameView | VideoFrameView | null , index : number | null ) {
3637 currentFrame = frame ;
37- if (index != null && index % 25 == 0 && index != 0 ) {
38+ if (index != null && index % 25 == 0 && index != 0 && currentIndex < index ) {
3839 loadFrames (index );
3940 }
4041 }
5455 }
5556
5657 function onPlay() {
57- loadFrames (0 );
58+ loadFrames (1 );
5859 }
5960 </script >
6061
9899 <div class =" min-w-full space-y-3 text-diffuse-foreground" >
99100 <div class =" flex items-start gap-3" >
100101 <span class =" truncate text-sm font-medium" title =" Width" >Width:</span >
101- <span class ="text-sm" >{sample .width }px</span >
102+ <span class ="text-sm" >{sample ? .width }px</span >
102103 </div >
103104 <div class =" flex items-start gap-3" >
104105 <span class =" truncate text-sm font-medium" title =" Height" >Height:</span >
105- <span class ="text-sm" >{sample .height }px</span >
106+ <span class ="text-sm" >{sample ? .height }px</span >
106107 </div >
107108 <div class =" flex items-start gap-3" >
108109 <span class =" truncate text-sm font-medium" title =" Duration" >Duration:</span >
109- <span class ="text-sm" >{sample .duration_s .toFixed (2 )} seconds</span >
110+ <span class ="text-sm" >{sample ? .duration_s ? .toFixed (2 )} seconds</span >
110111 </div >
111112 <div class =" flex items-start gap-3" >
112113 <span class =" truncate text-sm font-medium" title =" FPS" >FPS:</span >
113- <span class ="text-sm" >{sample .fps .toFixed (2 )}</span >
114+ <span class ="text-sm" >{sample ? .fps .toFixed (2 )}</span >
114115 </div >
115116 </div >
116117 </Segment >
You can’t perform that action at this time.
0 commit comments