mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
Merge branch 'staging' of https://github.com/mazeincoding/AppCut into staging
This commit is contained in:
@@ -82,6 +82,24 @@ export const usePlaybackStore = create<PlaybackStore>((set, get) => ({
|
|||||||
speed: 1.0,
|
speed: 1.0,
|
||||||
|
|
||||||
play: () => {
|
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 });
|
set({ isPlaying: true });
|
||||||
startTimer(get);
|
startTimer(get);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user