From d9fcef93852d84a8f95778cef535fcd7233418a0 Mon Sep 17 00:00:00 2001 From: DevloperAmanSingh Date: Wed, 25 Jun 2025 16:34:12 +0530 Subject: [PATCH] fix(playback-store): reset playhead and notify video elements on completion --- apps/web/src/stores/playback-store.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/web/src/stores/playback-store.ts b/apps/web/src/stores/playback-store.ts index 0127edf..0cc01cc 100644 --- a/apps/web/src/stores/playback-store.ts +++ b/apps/web/src/stores/playback-store.ts @@ -21,7 +21,13 @@ const startTimer = (store: any) => { const newTime = state.currentTime + delta * state.speed; if (newTime >= state.duration) { + // When video completes, pause and reset playhead to start state.pause(); + state.setCurrentTime(0); + // Notify video elements to sync with reset + window.dispatchEvent( + new CustomEvent("playback-seek", { detail: { time: 0 } }) + ); } else { state.setCurrentTime(newTime); // Notify video elements to sync