Cache-bust clip URLs with meta.version; bump to v2 for real footage

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
m3ultra 2026-07-19 23:49:17 +10:00
parent 7f829241a9
commit 30dcf11401
2 changed files with 46 additions and 8 deletions

View File

@ -34,10 +34,12 @@ async function boot() {
requestAnimationFrame(tick); requestAnimationFrame(tick);
} }
const vurl = (url) => url + "?v=" + (G.data?.meta?.version || 0); // cache-bust per data version
async function preload(url) { async function preload(url) {
if (!url || G.blobs.has(url)) return G.blobs.get(url); if (!url || G.blobs.has(url)) return G.blobs.get(url);
try { try {
const b = await (await fetch(url)).blob(); const b = await (await fetch(vurl(url))).blob();
const o = URL.createObjectURL(b); const o = URL.createObjectURL(b);
G.blobs.set(url, o); G.blobs.set(url, o);
return o; return o;
@ -47,7 +49,7 @@ async function preload(url) {
// ---------- clip playback (A/B swap) ---------- // ---------- clip playback (A/B swap) ----------
function playClip(url, onEnded) { function playClip(url, onEnded) {
const next = vids[1 - cur]; const next = vids[1 - cur];
next.src = G.blobs.get(url) || url; next.src = G.blobs.get(url) || vurl(url);
next.onended = null; next.onended = null;
next.currentTime = 0; next.currentTime = 0;
const p = next.play(); const p = next.play();

View File

@ -1,18 +1,40 @@
{ {
"meta": { "title": "RECORD STORE GUY", "lives": 5, "version": 1 }, "meta": {
"title": "RECORD STORE GUY",
"lives": 5,
"version": 2
},
"start": "s01", "start": "s01",
"scenes": { "scenes": {
"s01": { "s01": {
"clip": "clips/s01_action.mp4", "clip": "clips/s01_action.mp4",
"death": "clips/s01_death.mp4", "death": "clips/s01_death.mp4",
"windows": [{ "t": [4.6, 5.4], "input": "left", "cue": true }], "windows": [
{
"t": [
4.6,
5.4
],
"input": "left",
"cue": true
}
],
"onSuccess": "s02", "onSuccess": "s02",
"checkpoint": true "checkpoint": true
}, },
"s02": { "s02": {
"clip": "clips/s02_action.mp4", "clip": "clips/s02_action.mp4",
"death": "clips/s02_death.mp4", "death": "clips/s02_death.mp4",
"windows": [{ "t": [4.2, 5.0], "input": "up", "cue": true }], "windows": [
{
"t": [
4.2,
5.0
],
"input": "up",
"cue": true
}
],
"onSuccess": "s03", "onSuccess": "s03",
"checkpoint": false "checkpoint": false
}, },
@ -20,8 +42,22 @@
"clip": "clips/s03_action.mp4", "clip": "clips/s03_action.mp4",
"death": "clips/s03_death.mp4", "death": "clips/s03_death.mp4",
"windows": [ "windows": [
{ "t": [2.4, 3.1], "input": "left", "cue": true }, {
{ "t": [4.6, 5.3], "input": "up", "cue": true } "t": [
2.4,
3.1
],
"input": "left",
"cue": true
},
{
"t": [
4.6,
5.3
],
"input": "up",
"cue": true
}
], ],
"onSuccess": "WIN", "onSuccess": "WIN",
"checkpoint": false "checkpoint": false