Skip to content

best way to save what you love

api/internal-hls: transform segment uri when probing the HLS tunnel

wukko0ce777cbfc20
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;
})
);