Log why a track falls back to audio-only

Whether a clip gets a picture is decided by a format lookup whose failure
was only logged at debug, so an audio-only fallback was indistinguishable
from video being broken. The reason is now visible at the default log
level, and taking the video path says so too.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Leonid Pershin
2026-09-09 02:07:02 +03:00
co-authored by Claude Opus 5
parent 25776a0208
commit 0b166304c2
+10 -2
View File
@@ -363,9 +363,17 @@ export async function hasProgressiveVideo(pageUrl: string, maxHeight: number): P
"%(format_id)s",
pageUrl,
]);
return stdout.trim().length > 0;
const formatId = stdout.trim();
if (!formatId) {
log.warn({ pageUrl }, "no progressive format offered, playing audio only");
return false;
}
log.info({ pageUrl, formatId }, "progressive format for video playback");
return true;
} catch (err) {
log.debug({ err, pageUrl }, "no progressive format for video playback");
// Worth seeing: this is the difference between "clip plays" and "sound only".
const reason = err instanceof Error ? err.message : String(err);
log.warn({ pageUrl, reason }, "format lookup failed, playing audio only");
return false;
}
}