fix(player): align long caption timestamps with VTT

This commit is contained in:
XZH 2026-08-29 01:15:54 -07:00
parent 0d3573a723
commit ca670d5974
2 changed files with 6 additions and 2 deletions

View File

@ -633,10 +633,14 @@ function parseCaptionTimestamp(value) {
const parsedPart = parseFloat(part); const parsedPart = parseFloat(part);
if (!isFinite(parsedPart)) return null; if (!isFinite(parsedPart)) return null;
if (i > 0 && i < clockParts.length - 1 && parsedPart >= 60) return null; if (clockParts.length === 3 && i === 1 && parsedPart >= 60) return null;
if (i === clockParts.length - 1 && clockParts.length > 1 && parsedPart >= 60) return null; if (i === clockParts.length - 1 && clockParts.length > 1 && parsedPart >= 60) return null;
if (i === clockParts.length - 1) seconds += parsedPart; if (i === clockParts.length - 1) seconds += parsedPart;
else seconds += parsedPart * Math.pow(60, clockParts.length - i - 1); else {
const multiplier = clockParts.length === 2 && i === 0 && parsedPart >= 60 ?
3600 : Math.pow(60, clockParts.length - i - 1);
seconds += parsedPart * multiplier;
}
} }
return seconds; return seconds;

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB