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

FetchLoader export #6707

Closed
austinh opened this issue Sep 19, 2024 · 2 comments · Fixed by #6733
Closed

FetchLoader export #6707

austinh opened this issue Sep 19, 2024 · 2 comments · Fixed by #6733
Labels
Milestone

Comments

@austinh
Copy link

austinh commented Sep 19, 2024

What do you want to do with Hls.js?

Hello, I am trying to import FetchLoader and use it in my config as the default loader, but it doesn't seem this api is exposed by the package on npm. Is there some other way to use this class?

Also second question, is it possible to get a reference to the AbortController signal of a FetchLoader fetch request?
.

What have you tried so far?

import FetchLoader from "hls.js/src/utils/fetch-loader.js";

see stackblitz.
https://stackblitz.com/edit/vitejs-vite-hu52ve?file=src%2FCustomLoader.ts

@austinh austinh added Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question labels Sep 19, 2024
@austinh austinh changed the title FetchLoader FetchLoader export Sep 19, 2024
@robwalch
Copy link
Collaborator

robwalch commented Sep 20, 2024

v1.6 will provide named exports in the es module library along with the default Hls export also found in the es5/UMD library. See src/exports-named.ts. It does not include the loader classes. That would be a great addition. Please file a PR.

Source files are not included in the npm distro.

Aborting requests should be performed using HLS.js either by calling hls.stopLoad() or abort on a loader instance. Handling of external aborts on fetch or XHR instances used by internal loaders is not supported.

@robwalch robwalch added this to the 1.6.0 milestone Oct 1, 2024
@robwalch robwalch removed the Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. label Oct 1, 2024
robwalch added a commit that referenced this issue Oct 1, 2024
…ntroller, requestMediaKeySystemAccess in ESM output (hls.mjs)

Fix: Disable progressive callbacks in fLoader when progressive mode is disabled
Resolves #6707
@robwalch
Copy link
Collaborator

robwalch commented Oct 1, 2024

Hi @austinh,

#6733 should address this issue. With this change you can import FetchLoader from hls.mjs.

    <script type="module">
      import { Hls, FetchLoader, XhrLoader } from 'hls.mjs';

      var video = document.getElementById('video');
      if (Hls.isSupported()) {
        var hls = (window.hls = new Hls({
          fLoader: FetchLoader,
          pLoader: XhrLoader,

Let me know if this works for you. Thanks!

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

Successfully merging a pull request may close this issue.

2 participants