vidstack / player

UI components and hooks for building video/audio players on the web. Robust, customizable, and accessible. Modern alternative to JW Player and Video.js.
https://vidstack.io
MIT License
1.9k stars 114 forks source link

how to modify the request headers? #1261

Closed engAmirEng closed 2 months ago

engAmirEng commented 2 months ago

I'm using hls and I want to send the authorization header to the server for each request, how is it possible to do that?

mihar-22 commented 2 months ago

This isn't an issue, in the future please open a discussion on GitHub or a help post in our Discord channel. I also don't know what framework you're using so provide more info when opening issues, don't be lazy otherwise I might close in the future.

You need to configure the HLS instance:

provider.config = {
  xhrSetup: (xhs, url) => {
    xhr.setRequestHeader('', '');
  }
}