feat: media processing pipeline, spatial indexing, canvas-based video rendering
- Background media worker: polls media_jobs table, runs ffprobe+ffmpeg with concurrency limit, generates video posters, emits socket events - Non-blocking video upload: stores file + enqueues job, returns immediately - Poster hydration on board load: GET /boards/:id injects poster/dimensions from DB into canvas_state video objects - SpatialGrid: fixed-cell (512px) spatial hash for O(nearby) culling instead of O(all) item scanning, eliminates setTimeout violations - Canvas-based video rendering: draws video frames to offscreen canvas then uploads to GPU, completely eliminates GL_INVALID_OPERATION errors from PixiJS VideoSource auto-update mechanism - Server poster upgrade path: culling ticker and applyProcessedMedia() both upgrade client-captured posters to server posters when available - Pause restores server poster (paused video behaves like an image) - Selection drag-end persistence: onObjectDragEnd broadcasts + saves + undo - Live media:job:update socket handler patches scene data + VideoSprite dimensions without broadcast fanout
This commit is contained in:
@@ -174,6 +174,14 @@ async function start() {
|
||||
console.error('[server] MM watcher failed to start:', err.message);
|
||||
}
|
||||
|
||||
// Start media processing worker
|
||||
try {
|
||||
const { startMediaWorker } = require('./services/media-worker');
|
||||
startMediaWorker(io);
|
||||
} catch (err) {
|
||||
console.error('[server] Media worker failed to start:', err.message);
|
||||
}
|
||||
|
||||
server.listen(PORT, '0.0.0.0', () => {
|
||||
console.log(`[server] RefBoard backend listening on port ${PORT}`);
|
||||
});
|
||||
@@ -188,6 +196,11 @@ function shutdown(signal) {
|
||||
stopWatcher();
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
const { stopMediaWorker } = require('./services/media-worker');
|
||||
stopMediaWorker();
|
||||
} catch {}
|
||||
|
||||
io.close(() => {
|
||||
console.log('[server] Socket.IO closed');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user