From 0ce777cbfc200387972755a3501f69e243c757cd Mon Sep 17 00:00:00 2001 From: wukko Date: Thu, 6 Feb 2025 14:29:42 +0600 Subject: [PATCH] api/internal-hls: transform segment uri when probing the HLS tunnel --- api/src/stream/internal-hls.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/src/stream/internal-hls.js b/api/src/stream/internal-hls.js index e4416288..b56c93ff 100644 --- a/api/src/stream/internal-hls.js +++ b/api/src/stream/internal-hls.js @@ -121,7 +121,15 @@ export async function probeInternalHLSTunnel(streamInfo) { if (!randomSegment.uri) throw "segment is missing URI"; - const segmentSize = await getSegmentSize(randomSegment.uri, config) / randomSegment.duration; + let segmentUrl; + + if (getURL(randomSegment.uri)) { + segmentUrl = new URL(randomSegment.uri); + } else { + segmentUrl = new URL(randomSegment.uri, streamInfo.url); + } + + const segmentSize = await getSegmentSize(segmentUrl, config) / randomSegment.duration; return segmentSize; }) );