custom transport
Is your feature request related to a problem? Please describe.
i have custom transport with refresh token logic with same intrerface as common fetch. FetchLoader uses fetch, can i replace it with my own?
Describe the solution you'd like
import { Hls, FetchLoader } from 'hls.mjs';
const transport = new CustomTransport()
var video = document.getElementById('video');
if (Hls.isSupported()) {
var hls = (window.hls = new Hls({
loader: FetchLoader,
customFetch: transport.fetch
})
}
Additional context
No response
FetchLoader uses the global fetch. There is no way to pass a different fetch method to FetchLoader.
The preferred way to do any custom data transfer would be to create a new custom loader and replace loader with the custom loader n the config. If you transport mimics fetch and its interfaces, you could extend FetchLoader with a custom loader class that overrides (and copies) load using your transport.fetch.
If you'd like to make a PR that puts the global fetch into the default config so that you could replace it with your own, we could accept that as a solution to this issue.