Skip to content

Commit

Permalink
chore(example/browser): fix ALR requests failing
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Aug 18, 2023
1 parent 9971ffe commit eb3cca1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions examples/browser/web/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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 }
Expand Down

0 comments on commit eb3cca1

Please sign in to comment.