Read a driven video's speed on the frame clock so 1x stays 1x (#404)
A driven video measures how fast its wearer's time runs and sets its playbackRate from that. The time moves on with the ticker, but the reading took its clock from performance.now() while drawing. A frame that had more to do before the draw shifted that clock against the time, and a 1x animation read as up to 1.09. Outside 0.9 to 1.1 the video goes mute, so the sound could drop out for a moment. In CI this made e2e 66k red now and then. - VideoLibrary reads the speed with the timestamp of the frame (document.timeline.currentTime), the same clock the time runs on. It falls back to performance.now() where there is no document. - debugInfo() reports the measured speed of a driven player. - e2e 66k checks the measured speed and the correction of the rate apart. The rate alone may differ from 1 by up to 10 percent on purpose, so checking it at +-0.1 was too strict. Tests: - Unit video-library: 8 tests green, 1 new. With performance.now() back in place the new test is red and reads 1.089. - e2e 66 on melektaus-atx: all passed, 27 checks, speed 1.000 in all 5 readings. - Gate on melektaus-atx: CHECK EXIT 0, 297 files, 4562 tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8679dfbe65
commit
3a1e420806
3 files changed
+54
-4
No files matched your search
@@ -348,9 +348,17 @@ export async function video(t) {
|
||||
}
|
||||
await click(playCut.x, playCut.y);
|
||||
const gap = (a, b) => Math.min(Math.abs(a - b), 2 - Math.abs(a - b));
|
||||
// The speed read is 1x; the rate is that, nudged by at most a tenth towards the asked time.
|
||||
check(
|
||||
'playing the animation plays the video along at 1x and lets it be heard',
|
||||
along.every((p) => !p.paused && !p.muted && Math.abs(p.rate - 1) <= 0.1 && gap(p.time, p.asked) < 0.15),
|
||||
along.every(
|
||||
(p) =>
|
||||
!p.paused &&
|
||||
!p.muted &&
|
||||
Math.abs(p.speed - 1) <= 0.1 &&
|
||||
Math.abs(p.rate / p.speed - 1) <= 0.1 + 1e-9 &&
|
||||
gap(p.time, p.asked) < 0.15,
|
||||
),
|
||||
JSON.stringify(along),
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user