From ce368c9e6e25b8d57ef1f3d3b7a9e696bea88ca2 Mon Sep 17 00:00:00 2001 From: talksik Date: Thu, 9 Apr 2026 11:00:55 -0700 Subject: [PATCH] fix: broken screen clip playback progress It wasn't progressing, likely because the metadata for a screen recording was not read by the video html element. So we fallback to our own duration metadata. Closes #135 --- js/src/features/particles/media-particle-view.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/src/features/particles/media-particle-view.tsx b/js/src/features/particles/media-particle-view.tsx index 78cdcaa..1d5d0a2 100644 --- a/js/src/features/particles/media-particle-view.tsx +++ b/js/src/features/particles/media-particle-view.tsx @@ -94,7 +94,12 @@ export const MediaParticleView = forwardRef) => { const { currentTime: time, duration } = e.currentTarget; setCurrentTime(time); - if (duration > 0) onProgress?.(time / duration); + // WebM files from MediaRecorder (screen recordings) often report Infinity/NaN + // duration until fully buffered — fall back to the known duration from metadata. + const effectiveDuration = Number.isFinite(duration) && duration > 0 + ? duration + : particle.properties.duration_ms / 1000; + if (effectiveDuration > 0) onProgress?.(time / effectiveDuration); }; const attachmentOverlay = attachments.length > 0 && (