fix: seek now auto-starts playback for intuitive interaction

Changed seek behavior to match user expectations:
- Clicking on waveform now immediately starts playing from that position
- Dragging timeline slider starts playback at the selected position
- No need to click Play button after seeking

Previous behavior:
- seek() only continued playback if music was already playing
- Otherwise it just set isPaused = true
- User had to seek AND THEN click play button

New behavior:
- seek() always starts playback automatically
- Click anywhere → music plays from that position
- Much more intuitive UX matching common audio editors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-17 17:24:31 +01:00
parent 958c6d6680
commit 19bf7dc68a

View File

@@ -114,22 +114,18 @@ export class AudioPlayer {
}
/**
* Seek to a specific time
* Seek to a specific time and start playback
*/
async seek(time: number): Promise<void> {
if (!this.audioBuffer) return;
const wasPlaying = this.isPlaying;
const clampedTime = Math.max(0, Math.min(time, this.audioBuffer.duration));
this.stop();
this.pauseTime = clampedTime;
if (wasPlaying) {
// Always start playback after seeking
await this.play(clampedTime);
} else {
this.isPaused = true;
}
}
/**