Fix laggy Disney+ time by preferring the live "time remaining" indicator

Disney+ throttles the scrubber slider's aria-valuenow, so it can lag real
playback by several seconds (and its value snaps back when the control
overlay reappears on pause). The player's "time remaining" indicator,
however, updates live.

getDisneyPlusUiTimeline() now captures any element whose class/testid
mentions "remain", parses its clock text, and — when a reliable duration
is known — derives current = duration - remaining and prefers it over the
laggy slider value. Falls back to the previous behavior when no remaining
indicator is present.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Timo
2026-07-02 14:26:53 +02:00
parent 51da169d69
commit 8fe1c6dfbc
+16
View File
@@ -144,6 +144,7 @@
const ranges = video.seekable;
if (!ranges || ranges.length === 0) return null;
const current = video.currentTime;
let index = ranges.length - 1;
if (Number.isFinite(current)) {
for (let i = 0; i < ranges.length; i++) {
if (current >= ranges.start(i) && current <= ranges.end(i)) {
@@ -175,9 +176,24 @@
const current = parseClockTime(matches[0]);
const duration = parseClockTime(matches[matches.length - 1]);
if (!Number.isFinite(current) || !Number.isFinite(duration) || duration < 60 || current > duration + 5) return null;
return { current, duration };
}
function getDisneyPlusUiTimeline() {
if (typeof document === 'undefined') return null;
const selectors = [
'[role="slider"]',
'[role="progressbar"]',
'[aria-valuenow][aria-valuemax]',
'[aria-valuetext]',
'[aria-label]',
'[data-testid]',
'[data-test]',
'[class*="time" i]',
'[class*="progress" i]',
'time',
'output',
'button',
'span',
'p',
'div'