perf(sim): preload all clips into memory for instant altitude swaps #19
Reference in New Issue
Block a user
Delete Branch "feature/preload-media-cache"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Preload all clips into memory for instant altitude swaps — answers "can we preload all the videos so things load faster when changing altitudes?"
Problem
Each altitude change reset the single
<video>element'ssrcand re-fetched the scale's footage over the network. The devno-storecache policy applied to/mediatoo, so every scale change paid a full fetch + decode round-trip.Change
simulator/app.py— split the cache middleware: app shell / JS / CSS stayno-store(by-eye dev iteration), but/mediais now cacheable (public, max-age, immutable) since the clips are static.simulator/static/app.js— preload every ring clip (19 base + 5 transition, ~350 MB) into in-memory blob object URLs at startup. Non-blocking: the first scale plays immediately while the rest stream in, ordered current-scale-outward.mediaUrl()serves the cached blob when ready, else falls back to the network. A small progress chip self-removes when done.no-storeand/mediais cacheable.Verification
269 passed, 2 skipped./&/app.js→no-store;/media/...→public, max-age=31536000, immutable.🤖 Generated with Claude Code