chore: do not fail resolution if height guessing fails

This commit is contained in:
WebStreamr 2026-01-09 20:00:46 +00:00
parent 515ca0a98c
commit 28a8a1554d
No known key found for this signature in database

View file

@ -17,7 +17,13 @@ export const guessHeightFromPlaylist = async (ctx: Context, fetcher: Fetcher, pl
return height;
}
const m3u8Data = await fetcher.text(ctx, playlistUrl, init);
let m3u8Data: string;
try {
m3u8Data = await fetcher.text(ctx, playlistUrl, init);
} catch {
/* istanbul ignore next */
return undefined;
}
const heights = Array.from(m3u8Data.matchAll(/\d+x(\d+)|(\d+)p/g))
.map(heightMatch => heightMatch[1] ?? heightMatch[2])