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:
parent
7f829241a9
commit
30dcf11401
@ -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();
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user