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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user