Skip to content

fix(runtime): wait for a finite dotlottie duration - #3651

Merged
jrusso1020 merged 1 commit into
mainfrom
fix/lottie-finite-duration
Sep 4, 2026
Merged

fix(runtime): wait for a finite dotlottie duration#3651
jrusso1020 merged 1 commit into
mainfrom
fix/lottie-finite-duration

Conversation

@jrusso1020

Copy link
Copy Markdown
Collaborator

A dotlottie v1 player reporting zero duration could receive seek(NaN) at time zero and blank its first frame. Wait for a positive finite duration before seeking, then preserve the existing percentage clamping.

Builds on #1577 by @calcarazgre646, refreshed against current main with invalid-duration and delayed-load coverage.

Validation: regression tests failed before the fix; all 171 adapter tests pass, runtime typecheck passes, and all pre-commit checks pass.

@miga-heygen miga-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at exact fbffbf7cd.

Correct fix. When anim.duration is 0, undefined, NaN, or Infinity, the old code computed seek(NaN) or seek(Infinity), blanking the first frame. The guard (Number.isFinite(duration) && duration > 0) is the right predicate — it rejects all degenerate values and waits for the player to report a real duration before seeking.

Two tests cover both the degenerate cases (parameterized over 0, -1, NaN, Infinity, undefined) and the delayed-load scenario where duration transitions from 0 to a real value mid-session. The seek assertions ([50], [0], [100]) verify percentage clamping still works. Clean +29/-3.

— Miga

@jrusso1020
jrusso1020 merged commit bec11b1 into main Sep 4, 2026
59 checks passed
@jrusso1020
jrusso1020 deleted the fix/lottie-finite-duration branch September 4, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants