Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set Authorization headers for HLS #8928

Open
lfuelling opened this issue Nov 25, 2024 · 1 comment
Open

Unable to set Authorization headers for HLS #8928

lfuelling opened this issue Nov 25, 2024 · 1 comment

Comments

@lfuelling
Copy link

I have a stream that requires Auhtorization headers and had this code which worked until recently:

player.tech().vhs.xhr.onRequest((opts) => {
      if (!opts.headers) {
        opts.headers = {};
      }
      opts.headers["Authorization"] = localStorage.getItem("token");
    });

I am sure that this worked with v8.19.1 before, but since at least a few days, I get this error:

Uncaught TypeError: Cannot read properties of undefined (reading 'headers')

When I look at the types, it seems like this property never existed:

onRequest?: (args: ServeOnRequestArgs) => void

export interface ServeOnRequestArgs {
  remoteAddress: string
  method: string
  path: string
  status: number
  /** The time to generate the response, not to send it */
  timeInMS: number
}

What's the proper way to set authorization headers for HLS now?

Copy link

welcome bot commented Nov 25, 2024

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant