From 161c89acf704fd3173e8b8cb9999fb66d224498f Mon Sep 17 00:00:00 2001 From: talksik Date: Tue, 24 Mar 2026 07:13:08 -0700 Subject: [PATCH] feat: resume playback on the clip after we left off --- js/src/hooks/use-stream-playback.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/src/hooks/use-stream-playback.ts b/js/src/hooks/use-stream-playback.ts index 8ea3e85..f0b4edc 100644 --- a/js/src/hooks/use-stream-playback.ts +++ b/js/src/hooks/use-stream-playback.ts @@ -163,13 +163,16 @@ export function useStreamPlayback( // Try to find the marker's target particle const found = children.find( - (c) => c.created_at.getTime() === playbackPosition.getTime(), + (c) => c.created_at.getTime() > playbackPosition.getTime(), ); if (found) { initializedForRef.current = streamParticle.id; dispatch({ type: "INIT", particleId: found.id }); return; + } else { + initializedForRef.current = streamParticle.id; + dispatch({ type: "INIT", particleId: children[children.length - 1].id }); } // Marker target not found yet — fall back after timeout