fix(refboard): server posters respect culling budget + fix temp dir leak

1. Server posters no longer auto-load in VideoSprite constructor.
   loadServerPoster() is now public and called by the culling system
   only when within MAX_POSTER_VIDEOS budget. Videos outside the
   budget stay as placeholders regardless of server poster availability.

2. video-utils cleanup() now uses statSync to distinguish files from
   directories, unlinks files first, then rmdirs. Previously tmpDir
   was passed through path.dirname() which resolved to /tmp instead
   of the created temp directory.
This commit is contained in:
Hiren Kangad
2026-03-10 12:19:43 +05:30
parent 198497381f
commit e3c3aaf558
3 changed files with 33 additions and 18 deletions
+7 -2
View File
@@ -248,9 +248,14 @@ const PixiCanvas = forwardRef<PixiCanvasHandle, PixiCanvasProps>(
}
}
// Capture posters for nearest subset (only if already initialized)
// Load posters for nearest subset within budget
for (const { item, sprite } of videoItems) {
if (shouldPoster.has(item.id) && sprite.isInitialized && !sprite.hasPoster) {
if (!shouldPoster.has(item.id) || sprite.hasPoster) continue;
if (sprite.hasServerPoster) {
// Server poster: load as image texture (no <video> needed)
sprite.loadServerPoster();
} else if (sprite.isInitialized) {
// Fallback: client-capture from video element
sprite.capturePoster();
}
}