Stories: Play resumes at the exact paused or sought moment

startScene takes fromProgress and starts partway into a shot: the camera
goes on along the rest of the flight, the hold waits only what is left
and the scene clock carries on from the same point.
This commit is contained in:
Sameh Khamis committed 2026-11-16 13:24:59 -08:00
1 parent fec84dbf78
commit 8734f5e515
11 files changed
+341 -45

No files matched your search

+8 -3
View File
@@ -258,10 +258,15 @@ class PlaybackClock {
this._shotProgressTimer = timer;
}
startScene(scene, shot, token) {
/** Drive the scene clock through one shot, `offsetSec` into it when resuming. */
startScene(scene, shot, token, offsetSec = 0) {
this.stopSceneTimer();
const generation = this._sceneGeneration;
const timing = this.timingForShot(scene, shot);
const offset = Math.max(
0,
Math.min(timing.durationSec, Number(offsetSec) || 0),
);
if (
generation !== this._sceneGeneration ||
this._destroyed ||
@@ -269,8 +274,8 @@ class PlaybackClock {
token.signal?.aborted
)
return timing;
const startedAt = this.now();
this.publish(scene, shot, timing.startElapsedSec, {
const startedAt = this.now() - offset * 1000;
this.publish(scene, shot, timing.startElapsedSec + offset, {
running: true,
});
if (