From 30dcf11401da7c204881b33c9c3e35a648f1aed1 Mon Sep 17 00:00:00 2001 From: m3ultra Date: Sun, 19 Jul 2026 23:49:17 +1000 Subject: [PATCH] Cache-bust clip URLs with meta.version; bump to v2 for real footage Co-Authored-By: Claude Fable 5 --- engine/player.js | 6 ++++-- engine/scenes.json | 48 ++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/engine/player.js b/engine/player.js index c245161..bb2d74c 100644 --- a/engine/player.js +++ b/engine/player.js @@ -34,10 +34,12 @@ async function boot() { requestAnimationFrame(tick); } +const vurl = (url) => url + "?v=" + (G.data?.meta?.version || 0); // cache-bust per data version + async function preload(url) { if (!url || G.blobs.has(url)) return G.blobs.get(url); try { - const b = await (await fetch(url)).blob(); + const b = await (await fetch(vurl(url))).blob(); const o = URL.createObjectURL(b); G.blobs.set(url, o); return o; @@ -47,7 +49,7 @@ async function preload(url) { // ---------- clip playback (A/B swap) ---------- function playClip(url, onEnded) { const next = vids[1 - cur]; - next.src = G.blobs.get(url) || url; + next.src = G.blobs.get(url) || vurl(url); next.onended = null; next.currentTime = 0; const p = next.play(); diff --git a/engine/scenes.json b/engine/scenes.json index 28c44c5..f9a41a4 100644 --- a/engine/scenes.json +++ b/engine/scenes.json @@ -1,18 +1,40 @@ { - "meta": { "title": "RECORD STORE GUY", "lives": 5, "version": 1 }, + "meta": { + "title": "RECORD STORE GUY", + "lives": 5, + "version": 2 + }, "start": "s01", "scenes": { "s01": { "clip": "clips/s01_action.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", "checkpoint": true }, "s02": { "clip": "clips/s02_action.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", "checkpoint": false }, @@ -20,11 +42,25 @@ "clip": "clips/s03_action.mp4", "death": "clips/s03_death.mp4", "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", "checkpoint": false } } -} +} \ No newline at end of file