feat(playback): shared player store to sync transcript<->audio (FR-REC-5)

This commit is contained in:
iamdoubz committed 2026-07-12 09:27:46 -05:00
1 parent c3da6cf0f3
commit 96d02cc220
1 file changed
+29
+29
View File
@@ -0,0 +1,29 @@
// Shared recording-playback state so the transcript (center pane,
// TranscriptNotes) and the <audio> element (side pane, SummaryPanel) can talk
// to each other across the App layout: click a transcript segment to seek the
// player, and highlight/auto-scroll the segment that's currently playing.
// Pure UI ephemera — no persistence, reset per meeting.
class PlayerStore {
/** Playback position in ms, pushed from the <audio> element's timeupdate. */
currentMs = $state(0);
/** Target of the latest seek request, in ms. */
seekMs = $state<number | null>(null);
/** Bumped on every seek() so clicking the *same* segment twice re-seeks
* (a plain seekMs assignment wouldn't fire when the value is unchanged). */
seekNonce = $state(0);
/** Ask the player to jump to `ms` and play (SummaryPanel watches seekNonce). */
seek(ms: number) {
this.seekMs = ms;
this.seekNonce++;
}
/** Clear when the selected meeting changes so a new recording starts at 0. */
reset() {
this.currentMs = 0;
this.seekMs = null;
}
}
export const player = new PlayerStore();