@braccato/core 1.16.11 → 1.16.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/engine.js +9 -0
  2. package/package.json +1 -1
package/dist/engine.js CHANGED
@@ -2332,6 +2332,12 @@ export function tickView(engine, currentTime, options) {
2332
2332
  }
2333
2333
  const timeJumped = Math.abs(currentTime - playbackClock.lastTime - (eventCreationTime - playbackClock.lastEventCreationTime) / 1000) >
2334
2334
  TIME_JUMP_THRESHOLD;
2335
+ // Without a player snapshot the reading is the media clock, which runs backwards only on a seek, so a
2336
+ // loop shorter than the jump threshold still re-arms lines. A snapshot host's extrapolated clock is
2337
+ // pulled back by every correction, so it is left to the threshold.
2338
+ const mediaSteppedBack = eventCreationTime === NO_PLAYER_SNAPSHOT &&
2339
+ isPlaying &&
2340
+ currentTime < playbackClock.lastTime - CLOCK_RESYNC_THRESHOLD_S;
2335
2341
  if (timeJumped)
2336
2342
  dropPendingLineScroll(engine);
2337
2343
  playbackClock.lastTime = currentTime;
@@ -2443,6 +2449,9 @@ export function tickView(engine, currentTime, options) {
2443
2449
  if (isPlaying)
2444
2450
  lineData.isAnimating = false; // reset the animation against current media time
2445
2451
  }
2452
+ // Lead-in animations have no timing sample for the drift check, so a jump while playing must reset them.
2453
+ if (((timeJumped && isPlaying) || mediaSteppedBack) && lineData.isAnimating)
2454
+ resetLineAnimationState(lineData);
2446
2455
  updateWordStates(lineData, currentTime);
2447
2456
  const nativeTimingSample = lineNativeTimingSample(lineData, currentTime);
2448
2457
  let usedNativeTimingSampleForDrift = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braccato/core",
3
- "version": "1.16.11",
3
+ "version": "1.16.13",
4
4
  "description": "Synchronized lyrics renderer with word-by-word animations",
5
5
  "type": "module",
6
6
  "license": "MIT",