From eb3cca1e2ebd3fd3eecfb1dd55b58642d4849a93 Mon Sep 17 00:00:00 2001 From: LuanRT Date: Fri, 18 Aug 2023 06:33:01 -0300 Subject: [PATCH] chore(example/browser): fix ALR requests failing --- examples/browser/web/src/main.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/browser/web/src/main.ts b/examples/browser/web/src/main.ts index 7d1ce24e..dfbb8fe0 100644 --- a/examples/browser/web/src/main.ts +++ b/examples/browser/web/src/main.ts @@ -115,12 +115,7 @@ async function main() { showUI({ hidePlayer: false }); - const dash = await info.toDash((url) => { - url.searchParams.set('__host', url.host); - url.host = 'localhost:8080'; - url.protocol = 'http'; - return url; - }); + const dash = await info.toDash(); const uri = 'data:application/dash+xml;charset=utf-8;base64,' + btoa(dash); @@ -183,6 +178,12 @@ async function main() { const url = new URL(uri); const headers = request.headers; + if (url.host.endsWith(".googlevideo.com") || headers.Range) { + url.searchParams.set('__host', url.host); + url.host = 'localhost:8080'; + url.protocol = 'http'; + } + request.method = 'POST'; // protobuf - { 15: 0 }