summaryrefslogtreecommitdiff
path: root/apps/web/src/stores/playback-store.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/src/stores/playback-store.ts')
-rw-r--r--apps/web/src/stores/playback-store.ts16
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/web/src/stores/playback-store.ts b/apps/web/src/stores/playback-store.ts
index 543865f9..70ff490d 100644
--- a/apps/web/src/stores/playback-store.ts
+++ b/apps/web/src/stores/playback-store.ts
@@ -20,8 +20,20 @@ const startTimer = (store: () => PlaybackStore) => {
lastUpdate = now;
const newTime = state.currentTime + delta * state.speed;
- if (newTime >= state.duration) {
- // When video completes, pause and reset playhead to start
+
+ // Get actual content duration from timeline store
+ const { useTimelineStore } = require("@/stores/timeline-store");
+ const actualContentDuration = useTimelineStore
+ .getState()
+ .getTotalDuration();
+
+ // Stop at actual content end, not timeline duration (which has 10s minimum)
+ // It was either this or reducing default min timeline to 1 second
+ const effectiveDuration =
+ actualContentDuration > 0 ? actualContentDuration : state.duration;
+
+ if (newTime >= effectiveDuration) {
+ // When content completes, pause and reset playhead to start
state.pause();
state.setCurrentTime(0);
// Notify video elements to sync with reset