From 644f8889959b66e0966d70e9219d23c471466794 Mon Sep 17 00:00:00 2001 From: lashman Date: Sat, 6 Jun 2026 22:39:00 +0300 Subject: [PATCH] log hls variant playlist segments for resume debug --- src/pages/PlayerPage.tsx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/pages/PlayerPage.tsx b/src/pages/PlayerPage.tsx index 887a5ef..b7e94e3 100644 --- a/src/pages/PlayerPage.tsx +++ b/src/pages/PlayerPage.tsx @@ -367,10 +367,24 @@ export default function PlayerPage() { .then(r => r.text()) .then(text => { const lines = text.split(/\r?\n/) - const segmentLines = lines.filter(l => l.includes('.m3u8') || l.includes('.ts') || l.includes('m4s') || l.includes('.mp4')) - console.log('[player] hls playlist first 12 lines', lines.slice(0, 12)) - console.log('[player] hls first 4 segment lines', segmentLines.slice(0, 4)) - console.log('[player] hls segments have runtimeTicks', segmentLines.some(l => l.includes('runtimeTicks='))) + const variantLine = lines.find(l => l.endsWith('.m3u8') && !l.startsWith('#')) + console.log('[player] hls master playlist', text) + if (variantLine) { + const variantUrl = variantLine.startsWith('http') + ? variantLine + : new URL(variantLine, fullUrl).toString() + return fetch(variantUrl, { headers: { Authorization: `MediaBrowser Token=${token}` } }).then(r => r.text()) + } + return null + }) + .then(variantText => { + if (!variantText) return + const lines = variantText.split(/\r?\n/) + const segmentLines = lines.filter(l => /\.(ts|m4s|mp4)(\?|$)/.test(l)) + console.log('[player] hls variant playlist (first 20 lines)', lines.slice(0, 20)) + console.log('[player] hls variant first 6 segment lines', segmentLines.slice(0, 6)) + console.log('[player] hls variant segments have runtimeTicks', segmentLines.some(l => l.includes('runtimeTicks='))) + console.log('[player] hls variant segments have StartTimeTicks', segmentLines.some(l => l.includes('StartTimeTicks='))) }) .catch(e => console.warn('[player] hls playlist fetch failed', e)) }