From ef87cd6910d4d7c625eda5c65b594e17b172b348 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 20 May 2025 15:12:08 +0200 Subject: [PATCH] Fix incorrect `progress` value being passed to react-spring in video player (#34740) --- app/javascript/mastodon/features/video/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/video/index.tsx b/app/javascript/mastodon/features/video/index.tsx index 0d1ecddcb..e9c3cdefb 100644 --- a/app/javascript/mastodon/features/video/index.tsx +++ b/app/javascript/mastodon/features/video/index.tsx @@ -346,8 +346,10 @@ export const Video: React.FC<{ const updateProgress = () => { nextFrame = requestAnimationFrame(() => { if (videoRef.current) { + const progress = + videoRef.current.currentTime / videoRef.current.duration; void api.start({ - progress: `${(videoRef.current.currentTime / videoRef.current.duration) * 100}%`, + progress: isNaN(progress) ? '0%' : `${progress * 100}%`, immediate: reduceMotion, config: config.stiff, });