Skip to content

fix(core): optimistic current time update on seek to prevent slider snap-back#799

Merged
mihar-22 merged 1 commit intomainfrom
fix/792-slider-seek-snapback
Mar 10, 2026
Merged

fix(core): optimistic current time update on seek to prevent slider snap-back#799
mihar-22 merged 1 commit intomainfrom
fix/792-slider-seek-snapback

Conversation

@mihar-22
Copy link
Copy Markdown
Member

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 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.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v10-sandbox Ready Ready Preview, Comment Mar 10, 2026 2:40am

Request Review

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 10, 2026

Deploy Preview for vjs10-site ready!

Name Link
🔨 Latest commit fb01134
🔍 Latest deploy log https://app.netlify.com/projects/vjs10-site/deploys/69af848ba879a100089918ed
😎 Deploy Preview https://deploy-preview-799--vjs10-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

🎨 @videojs/html

(no changes)

Presets (7)
Entry Size
/video (default) 21.98 kB
/video (default + hls) 152.49 kB
/video (minimal) 21.85 kB
/video (minimal + hls) 152.39 kB
/audio (default) 20.37 kB
/audio (minimal) 20.34 kB
/background 6.36 kB
Media (4)
Entry Size
/media/background-video 652 B
/media/container 1.86 kB
/media/hls-video 131.32 kB
/media/simple-hls-video 11.33 kB
Players (3)
Entry Size
/video/player 6.22 kB
/audio/player 6.21 kB
/background/player 6.21 kB
Skins (14)
Entry Type Size
/video/minimal-skin.css css 2.65 kB
/video/skin.css css 2.69 kB
/video/minimal-skin js 21.27 kB
/video/minimal-skin.tailwind js 20.40 kB
/video/skin js 21.38 kB
/video/skin.tailwind js 20.51 kB
/audio/minimal-skin.css css 2.13 kB
/audio/skin.css css 2.16 kB
/audio/minimal-skin js 19.80 kB
/audio/minimal-skin.tailwind js 18.84 kB
/audio/skin js 19.88 kB
/audio/skin.tailwind js 19.04 kB
/background/skin.css css 124 B
/background/skin js 1009 B
UI Components (21)
Entry Size
/ui/alert-dialog 2.02 kB
/ui/alert-dialog-close 1.20 kB
/ui/alert-dialog-description 1.13 kB
/ui/alert-dialog-title 1.15 kB
/ui/buffering-indicator 1.72 kB
/ui/captions-button 1.76 kB
/ui/controls 1.75 kB
/ui/fullscreen-button 1.74 kB
/ui/mute-button 1.74 kB
/ui/pip-button 1.74 kB
/ui/play-button 1.74 kB
/ui/playback-rate-button 1.77 kB
/ui/popover 3.02 kB
/ui/poster 1.64 kB
/ui/seek-button 1.75 kB
/ui/slider 2.21 kB
/ui/thumbnail 2.04 kB
/ui/time 1.85 kB
/ui/time-slider 2.93 kB
/ui/tooltip 2.42 kB
/ui/volume-slider 2.15 kB

Sizes are marginal over the root entry point.

⚛️ @videojs/react

(no changes)

Presets (7)
Entry Size
/video (default) 15.83 kB
/video (default + hls) 146.51 kB
/video (minimal) 15.83 kB
/video (minimal + hls) 146.66 kB
/audio (default) 13.58 kB
/audio (minimal) 13.61 kB
/background 3.14 kB
Media (3)
Entry Size
/media/background-video 539 B
/media/hls-video 131.60 kB
/media/simple-hls-video 11.74 kB
Skins (14)
Entry Type Size
/video/minimal-skin.css css 2.65 kB
/video/skin.css css 2.69 kB
/video/minimal-skin js 15.73 kB
/video/minimal-skin.tailwind js 18.21 kB
/video/skin js 15.72 kB
/video/skin.tailwind js 18.29 kB
/audio/minimal-skin.css css 2.13 kB
/audio/skin.css css 2.16 kB
/audio/minimal-skin js 13.53 kB
/audio/minimal-skin.tailwind js 15.25 kB
/audio/skin js 13.44 kB
/audio/skin.tailwind js 15.46 kB
/background/skin.css css 90 B
/background/skin js 272 B
UI Components (17)
Entry Size
/ui/alert-dialog 2.71 kB
/ui/buffering-indicator 2.20 kB
/ui/captions-button 2.26 kB
/ui/controls 2.23 kB
/ui/fullscreen-button 2.26 kB
/ui/mute-button 2.25 kB
/ui/pip-button 2.21 kB
/ui/play-button 2.25 kB
/ui/playback-rate-button 2.26 kB
/ui/popover 3.08 kB
/ui/poster 2.02 kB
/ui/seek-button 2.24 kB
/ui/slider 3.09 kB
/ui/time 2.39 kB
/ui/time-slider 3.24 kB
/ui/tooltip 3.22 kB
/ui/volume-slider 3.08 kB

Sizes are marginal over the root entry point.

🧩 @videojs/core

(no changes)

Entries (5)
Entry Size
. 4.78 kB
/dom 8.01 kB
/dom/media/custom-media-element 1.77 kB
/dom/media/hls 131.18 kB
/dom/media/simple-hls 11.28 kB

🏷️ @videojs/element

(no changes)

Entries (2)
Entry Size
. 999 B
/context 936 B

📦 @videojs/store

(no changes)

Entries (3)
Entry Size
. 1.32 kB
/html 700 B
/react 360 B

🔧 @videojs/utils

(no changes)

Entries (10)
Entry Size
/array 104 B
/dom 1003 B
/events 227 B
/function 261 B
/object 119 B
/predicate 265 B
/string 148 B
/style 190 B
/time 478 B
/number 158 B

📦 @videojs/spf

(no changes)

Entries (3)
Entry Size
. 40 B
/dom 9.48 kB
/playback-engine 9.37 kB

ℹ️ How to interpret

All sizes are standalone totals (minified + brotli).

Icon Meaning
No change
🔺 Increased ≤ 10%
🔴 Increased > 10%
🔽 Decreased
🆕 New (no baseline)

Run pnpm size locally to check current sizes.

@github-actions
Copy link
Copy Markdown
Contributor

CI Failure Diagnosis

File Type What failed
packages/core/src/core/ui/types.ts lint noBannedTypes: {} used as default type parameter (lines 6, 13) — use object or Record<string, never>.
packages/spf/src/core/state/create-state.ts:154 lint suppressions/unused: biome-ignore comment suppresses a rule that no longer triggers — remove it.
packages/spf/src/dom/features/end-of-stream.ts:208 lint noBannedTypes: {} used as type annotation — use object or Record<string, never>.

@mihar-22 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
@mihar-22 mihar-22 merged commit c605df5 into main Mar 10, 2026
19 of 20 checks passed
@mihar-22 mihar-22 deleted the fix/792-slider-seek-snapback branch March 10, 2026 02:45
This was referenced Mar 10, 2026
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.

Clicking on time slider causes the thumb to jump back then forward

1 participant