summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevloperAmanSingh <amansinghneh211205@gmail.com>2025-06-25 16:34:12 +0530
committerDevloperAmanSingh <amansinghneh211205@gmail.com>2025-06-25 16:34:12 +0530
commitd9fcef93852d84a8f95778cef535fcd7233418a0 (patch)
treec02c144068250a65e21f2de027618c72635b0a77
parentc18b173bc918c7f1688a30586b75792938e57690 (diff)
downloadopencut-d9fcef93852d84a8f95778cef535fcd7233418a0.tar.gz
fix(playback-store): reset playhead and notify video elements on completion
-rw-r--r--apps/web/src/stores/playback-store.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/web/src/stores/playback-store.ts b/apps/web/src/stores/playback-store.ts
index 0127edff..0cc01cc1 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