The slider represents an entire timelapse sequence as one continuous timeline. Each video is approximately 4 seconds representing 1 hour of real time, compressed from thousands of source frames.
The core innovation is using an event-driven approach rather than time-based throttling or debouncing:
// Latest-only seek queue - process only the most recent request
let pendingSeek = null;
let seekScheduled = false;
function scheduleSeek(targetVideoIndex, targetTimeInVideo) {
// Overwrite any previous pending seek (latest wins)
pendingSeek = { targetVideoIndex, targetTimeInVideo };
if (!seekScheduled) {
seekScheduled = true;
setTimeout(() => {
if (pendingSeek) {
executeSeek(pendingSeek);
pendingSeek = null;
}
seekScheduled = false;
}, 0); // Next event loop tick
}
}
input
eventssetTimeout(0)
defers to next tick// Calculate target frame within video
const targetFrame = Math.floor(timeWithinVideo * TIMELAPSE_FPS);
const targetTimeInVideo = targetFrame / TIMELAPSE_FPS;
// Seek to exact frame position
mainVideo.currentTime = targetTimeInVideo;
input
: Triggers seek during drag
seeking
: Video starts seeking to new position
seeked
: Seek complete, can resume playback
mouseup
: Restores original play state
Smooth, responsive scrubbing that feels like professional video editing software. The latest-only event queue provides the perfect balance of responsiveness and efficiency, automatically adapting to system performance without requiring manual tuning.
Experience the smooth scrubbing behavior in action:
🎥 Open Timelapse PlayerLoad a playlist and try dragging the timeline slider to see the real-time seeking in action.