From 77eea010a6830b69ceb00a3a8622a0f74ab5906f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Apr 2026 09:31:33 +0000 Subject: [PATCH] Tidy DASH fallback and error matching per validation feedback Agent-Logs-Url: https://github.com/19JVJeffery/tiddl-gui/sessions/5e0218fc-7235-4e8b-8e82-52759274b754 Co-authored-by: 19JVJeffery <94115228+19JVJeffery@users.noreply.github.com> --- web/js/download.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/js/download.js b/web/js/download.js index f5f61ca..81f5d48 100644 --- a/web/js/download.js +++ b/web/js/download.js @@ -45,7 +45,7 @@ function parseDashManifest(manifest) { const segTpl = pick("SegmentTemplate"); const urlTemplate = segTpl?.getAttribute("media") || ""; const initTemplate = segTpl?.getAttribute("initialization") || ""; - const startNumber = Math.max(parseInt(segTpl?.getAttribute("startNumber") || "1", 10) || 1, 1); + const startNumber = parseInt(segTpl?.getAttribute("startNumber") || "1", 10) || 1; const timeline = doc.getElementsByTagNameNS(NS, "S").length ? [...doc.getElementsByTagNameNS(NS, "S")] @@ -56,6 +56,7 @@ function parseDashManifest(manifest) { const r = el.getAttribute("r"); if (r) segmentCount += parseInt(r, 10); } + // Some manifests omit SegmentTimeline; fall back to one media segment. if (!segmentCount) segmentCount = 1; const baseUrl = (pick("BaseURL")?.textContent || "").trim(); @@ -983,7 +984,7 @@ function shouldTryQualityFallback(err) { const msg = String(err?.message || "").toLowerCase(); if (!msg) return false; if (msg.includes("not authenticated")) return false; - return /403|404|quality|not available|not found|unsupported|forbidden/.test(msg); + return /403|404|quality|not available|not found|unsupported/.test(msg); } async function getTrackStreamWithFallback(trackId, requestedQuality, onProgress) {