简体   繁体   中英

Query parameters for m3u8 and ts urls. Hls.js

Question:

I'm struggling with adding query params to urls. I want to add ?md5=<string>&expires=<number> for each request url (m3u8, ts). I heard fetchSetup would be useful but I didn't see any examples, does anyone know how to solve this problem?

I already tried this but nothing happened:

const hlsConfig = {
  fetchSetup: (context, initParams) => {
    initParams.credentials = 'include';
    return new Request(
      context.url + '?md5=test123&expires=test123', 
      initParams
    );
  }
}

Related issues on Github: #2152 , #2142 .

Same question with video.js : Appending paramaters to each m3u8 and ts file while playing live stream

We've solved it by modifying window.XMLHttpRequest.prototype.open to update url. May be something related to xhrSetup (which was given a try but didn't spend much time).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM