You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clicking the time slider caused the thumb to snap back to the old position before jumping to the target because the store's currentTime only updated after the browser's async seeking/seeked events fired.
Changes
Optimistically patch currentTime and seeking in the seek() action before setting media.currentTime, so the slider reflects the target position immediately
Add tests verifying the optimistic update and its correction by the seeked event
Testing
pnpm -F @videojs/core test src/dom/store/features/tests/time.test.ts
Manual: open sandbox (pnpm dev:sandbox), play a video, click ahead on the time slider — thumb should not snap back.
noBannedTypes: {} used as type annotation — use object or Record<string, never>.
mihar-22
changed the title
fix(core): optimistic currentTime update on seek to prevent slider snap-back
fix(core): optimistic current time update on seek to prevent slider snap-back
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #792
Summary
Clicking the time slider caused the thumb to snap back to the old position before jumping to the target because the store's
currentTimeonly updated after the browser's asyncseeking/seekedevents fired.Changes
currentTimeandseekingin theseek()action before settingmedia.currentTime, so the slider reflects the target position immediatelyseekedeventTesting
pnpm -F @videojs/core test src/dom/store/features/tests/time.test.tsManual: open sandbox (
pnpm dev:sandbox), play a video, click ahead on the time slider — thumb should not snap back.