From 8bb924105cb58e7d49a0aa2282ff2a3ab1784ffa Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 20 May 2025 15:12:08 +0200 Subject: [PATCH] [Glitch] Fix incorrect `progress` value being passed to react-spring in video player Port ef87cd6910d4d7c625eda5c65b594e17b172b348 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/features/video/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/features/video/index.tsx b/app/javascript/flavours/glitch/features/video/index.tsx index 6525451f54..82dfacbab8 100644 --- a/app/javascript/flavours/glitch/features/video/index.tsx +++ b/app/javascript/flavours/glitch/features/video/index.tsx @@ -350,8 +350,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, });