-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Load manifest via local function bypass XMLHttpRequest #6863
Comments
That would be because the custom loader calls the default |
Sorry I thought I actually replied back to this, after many hours, the second I posted this I saw that I had the extra load() there. But when I take it out, it does stop calling the XMLHttpRequest for the page, but it doesn't actually do anything with the manifest I give it and nothing happens. No files are loaded and nothing is played. I put event listeners on for errors and nothing comes out and the debug shows no extra information. Manifest load/parsed event listeners also don't fire. |
Can you provide an example? The custom loader should look like this (you are responsible for any async logic and updating of loader stats): loader: class CustomLoader extends Hls.DefaultConfig.loader {
constructor(config) {
super(config);
}
load(context, config, callbacks) {
if (context.type === 'manifest') {
console.log('Custom loader invoked for manifest');
const manifestData = getCustomManifest();
const response = {
url: context.url,
data: manifestData,
code: 200
};
const stats = this.stats;
callbacks.onSuccess(response, stats, context, {});
} else {
// Fallback for other resource types
super.load(context, config, callbacks);
}
}
} |
What do you want to do with Hls.js?
Is it possible to set the calls to load the manifest to go via a local function rather than having to use a url in the load method? I need to do some other logic to generate the manifest so wanted to use a local function to generate it.
I tried creating my own custom loader and it calls the function but Hls is still calling an XMLHttpRequest for the entire page and parsing that response, and error'ing out on it, rather than using the supplied manifest. I tried copying the example code from the docs but am at a loss. Any help would be greatly appreciated.
What have you tried so far?
The text was updated successfully, but these errors were encountered: