m3u8 和 ts url 的查询参数。Hls.js

Art*_*hur 6 javascript video-streaming http-live-streaming m3u8 hls.js

问题:

我正在努力向网址添加查询参数。?md5=<string>&expires=<number>我想为每个请求网址(m3u8,ts)添加。我听说fetchSetup很有用,但我没有看到任何例子,有人知道如何解决这个问题吗?

我已经尝试过了,但什么也没发生:

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

Github 上的相关问题: #2152#2142

同样的问题video.jsAppending paramaters to every m3u8 and ts file while Playing live Stream

Cha*_*mar 2

我们通过修改 window.XMLHttpRequest.prototype.open 来更新 url 来解决这个问题。可能与 xhrSetup 有关(尝试过但没有花太多时间)。