Sample 68d's video wait from before the click on Play (#417)
CI task 669 failed in e2e 68d with no loading frame seen. The check began to sample after play(), and play() settles after the start. A video that loads quickly was ready by then, so the wait it checks had already passed. The composition itself had waited: its clock read 0 when the player was ready. - 68d starts its sampler before the click on Play and counts only frames in play mode. - The sampler stops after 20 s, not after a number of frames. Before the run the page draws far faster than 60 frames a second. Tests: - e2e 66, 67, 68 on melektaus-atx: ALL PASSED, 43 checks, 68d saw 6 loading frames at 0 and 0.32 s after Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
10c2c3c308
commit
40b6290d24
1 file changed
+16
-9
@@ -185,23 +185,30 @@ export async function composition(t) {
|
||||
c.objects = [{ ...structuredClone(c.objects[0]), id: 'cp68-v', assetId: 'cp68-screen', name: 'Video 68', overrides: {} }];
|
||||
c.items = [{ id: 'cp68-v', track: 'cp68-front', start: 0, length: 120, offset: 0 }];
|
||||
c.clips = [];`);
|
||||
await play();
|
||||
// The video time the composition writes into its item every frame.
|
||||
const clock = `__gm.world()?.entities.find((e) => e.objectId === '${id('v')}')?.props.videoTime ?? null`;
|
||||
const wait = JSON.parse(
|
||||
await evaluate(`new Promise((done) => {
|
||||
const loading = [];
|
||||
// Sampled from before the click on Play: play() settles after the start, and a video that loads
|
||||
// quickly is ready by then, with no wait left to see (CI task 669).
|
||||
await evaluate(`{
|
||||
const loading = [];
|
||||
const until = performance.now() + 20000;
|
||||
window.cp68Wait = new Promise((done) => {
|
||||
const step = () => {
|
||||
const time = ${clock};
|
||||
const player = __gm.gameVideo('${id('v')}');
|
||||
const playing = __gm.state.mode === 'play';
|
||||
const time = playing ? ${clock} : null;
|
||||
const player = playing ? __gm.gameVideo('${id('v')}') : null;
|
||||
if (player?.ready) return done(JSON.stringify({ loading, ready: time }));
|
||||
if (player) loading.push(time);
|
||||
if (!__gm.world() || loading.length > 300) return done(JSON.stringify({ loading, ready: null }));
|
||||
if (performance.now() > until) return done(JSON.stringify({ loading, ready: null }));
|
||||
requestAnimationFrame(step);
|
||||
};
|
||||
step();
|
||||
})`),
|
||||
);
|
||||
});
|
||||
// Not the promise as the block's value: evaluate would wait for it, and Play would come too late.
|
||||
null;
|
||||
}`);
|
||||
await play();
|
||||
const wait = JSON.parse(await evaluate('window.cp68Wait'));
|
||||
await sleep(500);
|
||||
const after = await json(clock);
|
||||
check(
|
||||
|
||||
Reference in new issue
Block a user