diff options
| author | Maze Winther <mazewinther@gmail.com> | 2025-08-12 12:38:26 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2025-08-12 12:38:26 +0200 |
| commit | ae987e1d66465e22330dad5d01aee5f55e2acf0e (patch) | |
| tree | aebd4f3f52052540a17697b7ee96c1eecc3545f6 /apps/web/src/stores | |
| parent | 8d3ccf0d56d3de1f5f4bfe78c42dc5694c00e6a8 (diff) | |
| parent | 3807e146e4e910d16b452b896d4faaf52a314160 (diff) | |
| download | opencut-ae987e1d66465e22330dad5d01aee5f55e2acf0e.tar.gz | |
Merge branch 'staging' of https://github.com/mazeincoding/AppCut into staging
Diffstat (limited to 'apps/web/src/stores')
| -rw-r--r-- | apps/web/src/stores/playback-store.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/web/src/stores/playback-store.ts b/apps/web/src/stores/playback-store.ts index feea0f46..a92cb530 100644 --- a/apps/web/src/stores/playback-store.ts +++ b/apps/web/src/stores/playback-store.ts @@ -82,6 +82,24 @@ export const usePlaybackStore = create<PlaybackStore>((set, get) => ({ speed: 1.0, play: () => { + const state = get(); + + const actualContentDuration = useTimelineStore + .getState() + .getTotalDuration(); + const effectiveDuration = + actualContentDuration > 0 ? actualContentDuration : state.duration; + + if (effectiveDuration > 0) { + const fps = useProjectStore.getState().activeProject?.fps ?? 30; + const frameOffset = 1 / fps; + const endThreshold = Math.max(0, effectiveDuration - frameOffset); + + if (state.currentTime >= endThreshold) { + get().seek(0); + } + } + set({ isPlaying: true }); startTimer(get); }, |
