feat #14740: play back calls
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// Couples playback to the transcript: which line is being heard.
|
||||
|
||||
/** The part of a transcript line the lookup needs. */
|
||||
export interface Timed {
|
||||
start: number
|
||||
end: number
|
||||
}
|
||||
|
||||
/** Index of the line heard at `secs`: the one whose `[start, end)` holds
|
||||
* it — of overlapping lines (both sides talking at once) the one that
|
||||
* started last. `null` before the first line, in a pause between lines and
|
||||
* after the last one. */
|
||||
export function segmentAt(segments: readonly Timed[], secs: number): number | null {
|
||||
let found: number | null = null
|
||||
segments.forEach((segment, i) => {
|
||||
if (segment.start <= secs && secs < segment.end) {
|
||||
if (found === null || segment.start >= segments[found].start) found = i
|
||||
}
|
||||
})
|
||||
return found
|
||||
}
|
||||
Reference in New Issue
Block a user