feat(config): add configuration window (#70)

This commit is contained in:
2026-05-21 04:16:21 -07:00
committed by GitHub
parent a54f03f0cd
commit dc52bc2fba
287 changed files with 14507 additions and 8134 deletions
@@ -0,0 +1,31 @@
import type { SubtitleCue } from '../../types';
export function selectAutoplayStartupCue(
cues: SubtitleCue[],
currentTimeSeconds: number,
lookaheadSeconds: number,
): SubtitleCue | null {
const currentTime = Math.max(0, Number.isFinite(currentTimeSeconds) ? currentTimeSeconds : 0);
const lookahead = Math.max(0, Number.isFinite(lookaheadSeconds) ? lookaheadSeconds : 0);
const latestStartTime = currentTime + lookahead;
for (const cue of cues) {
if (!cue.text.trim()) {
continue;
}
if (cue.startTime <= currentTime && cue.endTime > currentTime) {
return cue;
}
}
for (const cue of cues) {
if (!cue.text.trim()) {
continue;
}
if (cue.startTime >= currentTime && cue.startTime <= latestStartTime) {
return cue;
}
}
return null;
}