feat: resume playback on the clip after we left off

This commit is contained in:
talksik
2026-03-24 07:13:08 -07:00
parent 0f993772c9
commit 161c89acf7
+4 -1
View File
@@ -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