summaryrefslogtreecommitdiff
path: root/apps/web/src/core/managers/playback-manager.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-03-27 00:55:15 +0100
committerMaze Winther <mazewinther@gmail.com>2026-03-29 15:56:48 +0200
commit4d127a038bf768eded68aae3cfa5c1b12241bdac (patch)
tree16bbb801caf6770546cff4fdb37b6408ec9ead98 /apps/web/src/core/managers/playback-manager.ts
parent82817cb50cb0487350573d6129130aec705f924b (diff)
downloadopencut-4d127a038bf768eded68aae3cfa5c1b12241bdac.tar.gz
chore: normalize line endings
Diffstat (limited to 'apps/web/src/core/managers/playback-manager.ts')
-rw-r--r--apps/web/src/core/managers/playback-manager.ts24
1 files changed, 12 insertions, 12 deletions
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 {