Fix progress overlay, play-from-position, layout cutoff, speaker info

- Replace progress bar with task checklist showing pipeline steps
  (load model, transcribe, load diarization, identify speakers, merge)
- Fix WaveformPlayer: track ready state, disable controls until loaded,
  play from current position instead of resetting to start
- Fix workspace height calc to prevent bottom content cutoff
- Show HF_TOKEN setup hint in SpeakerManager when no speakers detected
- Add console logging for progress events to aid debugging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 18:02:48 -08:00
parent 4d7b9d524f
commit ed626b8ba0
5 changed files with 141 additions and 36 deletions

View File

@@ -12,6 +12,7 @@
let container: HTMLDivElement;
let wavesurfer: WaveSurfer | null = $state(null);
let isReady = $state(false);
let currentTime = $state('0:00');
let totalTime = $state('0:00');
@@ -39,6 +40,7 @@
});
wavesurfer.on('ready', () => {
isReady = true;
const dur = wavesurfer!.getDuration();
durationMs.set(Math.round(dur * 1000));
totalTime = formatTime(dur);
@@ -48,6 +50,10 @@
wavesurfer.on('pause', () => isPlaying.set(false));
wavesurfer.on('finish', () => isPlaying.set(false));
wavesurfer.on('loading', () => {
isReady = false;
});
if (audioUrl) {
wavesurfer.load(audioUrl);
}
@@ -57,20 +63,21 @@
wavesurfer?.destroy();
});
/** Toggle play/pause. Exposed for keyboard shortcuts. */
/** Toggle play/pause from current position. Exposed for keyboard shortcuts. */
export function togglePlayPause() {
wavesurfer?.playPause();
if (!wavesurfer || !isReady) return;
wavesurfer.playPause();
}
function skipBack() {
if (wavesurfer) {
if (wavesurfer && isReady) {
const time = Math.max(0, wavesurfer.getCurrentTime() - 5);
wavesurfer.setTime(time);
}
}
function skipForward() {
if (wavesurfer) {
if (wavesurfer && isReady) {
const time = Math.min(wavesurfer.getDuration(), wavesurfer.getCurrentTime() + 5);
wavesurfer.setTime(time);
}
@@ -78,17 +85,20 @@
/** Seek to a specific time in milliseconds. Called from transcript click-to-seek. */
export function seekTo(timeMs: number) {
console.log('[voice-to-notes] seekTo called:', timeMs, 'ms, wavesurfer:', !!wavesurfer, 'duration:', wavesurfer?.getDuration());
if (wavesurfer) {
wavesurfer.setTime(timeMs / 1000);
if (!wavesurfer.isPlaying()) {
wavesurfer.play();
}
if (!wavesurfer || !isReady) {
console.warn('[voice-to-notes] seekTo ignored — audio not ready yet');
return;
}
const timeSec = timeMs / 1000;
wavesurfer.setTime(timeSec);
if (!wavesurfer.isPlaying()) {
wavesurfer.play();
}
}
/** Load a new audio file. */
export function loadAudio(url: string) {
isReady = false;
wavesurfer?.load(url);
}
</script>
@@ -96,11 +106,17 @@
<div class="waveform-player">
<div class="waveform-container" bind:this={container}></div>
<div class="controls">
<button class="control-btn" onclick={skipBack} title="Back 5s"></button>
<button class="control-btn play-btn" onclick={togglePlayPause} title="Play/Pause">
{#if $isPlaying}{:else}{/if}
<button class="control-btn" onclick={skipBack} title="Back 5s" disabled={!isReady}>⏪</button>
<button class="control-btn play-btn" onclick={togglePlayPause} title="Play/Pause" disabled={!isReady}>
{#if !isReady}
{:else if $isPlaying}
{:else}
{/if}
</button>
<button class="control-btn" onclick={skipForward} title="Forward 5s"></button>
<button class="control-btn" onclick={skipForward} title="Forward 5s" disabled={!isReady}>⏩</button>
<span class="time">{currentTime} / {totalTime}</span>
</div>
</div>
@@ -130,9 +146,13 @@
cursor: pointer;
font-size: 1rem;
}
.control-btn:hover {
.control-btn:hover:not(:disabled) {
background: #1a4a7a;
}
.control-btn:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.play-btn {
padding: 0.4rem 1rem;
font-size: 1.2rem;