fix: comment out subtitles handling in getRiveStream function and add referer header

This commit is contained in:
himanshu8443
2025-09-02 15:14:44 +05:30
parent 2bc50d717b
commit e64eacee53
2 changed files with 17 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@@ -87,25 +87,28 @@ export async function getRiveStream(
headers: providerContext.commonHeaders, headers: providerContext.commonHeaders,
}); });
const subtitles: TextTracks = []; const subtitles: TextTracks = [];
if (res.data?.data?.captions) { // if (res.data?.data?.captions) {
res.data?.data?.captions.forEach((sub: any) => { // res.data?.data?.captions.forEach((sub: any) => {
subtitles.push({ // subtitles.push({
language: sub?.label?.slice(0, 2) || "Und", // language: sub?.label?.slice(0, 2) || "Und",
uri: sub?.file, // uri: sub?.file,
title: sub?.label || "Undefined", // title: sub?.label || "Undefined",
type: sub?.file?.endsWith(".vtt") // type: sub?.file?.endsWith(".vtt")
? "text/vtt" // ? "text/vtt"
: "application/x-subrip", // : "application/x-subrip",
}); // });
}); // });
} // }
res.data?.data?.sources.forEach((source: any) => { res.data?.data?.sources.forEach((source: any) => {
Streams.push({ Streams.push({
server: source?.source + "-" + source?.quality, server: source?.source + "-" + source?.quality,
link: source?.url, link: source?.url,
type: source?.format === "hls" ? "m3u8" : "mp4", type: source?.format === "hls" ? "m3u8" : "mp4",
quality: source?.quality, quality: source?.quality,
subtitles: subtitles, // subtitles: subtitles,
headers: {
referer: baseUrl,
},
}); });
}); });
} catch (e) { } catch (e) {