From 4d127a038bf768eded68aae3cfa5c1b12241bdac Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Fri, 27 Mar 2026 00:55:15 +0100 Subject: chore: normalize line endings --- apps/web/src/core/managers/playback-manager.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'apps/web/src/core/managers/playback-manager.ts') diff --git a/apps/web/src/core/managers/playback-manager.ts b/apps/web/src/core/managers/playback-manager.ts index 5993a503..6943f187 100644 --- a/apps/web/src/core/managers/playback-manager.ts +++ b/apps/web/src/core/managers/playback-manager.ts @@ -13,19 +13,19 @@ export class PlaybackManager { constructor(private editor: EditorCore) { this.editor.timeline.subscribe(() => { - const duration = this.editor.timeline.getTotalDuration(); - if (this.currentTime > duration && duration > 0) { - this.currentTime = duration; + const maxTime = this.editor.timeline.getLastSeekableTime(); + if (this.currentTime > maxTime && maxTime > 0) { + this.currentTime = maxTime; this.notify(); } }); } play(): void { - const duration = this.editor.timeline.getTotalDuration(); + const maxTime = this.editor.timeline.getLastSeekableTime(); - if (duration > 0) { - if (this.currentTime >= duration) { + if (maxTime > 0) { + if (this.currentTime >= maxTime) { this.seek({ time: 0 }); } } @@ -50,8 +50,8 @@ export class PlaybackManager { } seek({ time }: { time: number }): void { - const duration = this.editor.timeline.getTotalDuration(); - this.currentTime = Math.max(0, Math.min(duration, time)); + const maxTime = this.editor.timeline.getLastSeekableTime(); + this.currentTime = Math.max(0, Math.min(maxTime, time)); this.notify(); window.dispatchEvent( @@ -154,16 +154,16 @@ export class PlaybackManager { this.lastUpdate = now; const newTime = this.currentTime + delta; - const duration = this.editor.timeline.getTotalDuration(); + const maxTime = this.editor.timeline.getLastSeekableTime(); - if (duration > 0 && newTime >= duration) { + if (maxTime > 0 && newTime >= maxTime) { this.pause(); - this.currentTime = duration; + this.currentTime = maxTime; this.notify(); window.dispatchEvent( new CustomEvent("playback-seek", { - detail: { time: duration }, + detail: { time: maxTime }, }), ); } else { -- cgit v1.3.1