-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
removeLevel API change #6265
Comments
Hi @PavelFomin90, v1.5 no longer groups redundant HLS variants (with the same attributes but different URLs) into the same HLS.js Level with level.url[] indexes. Instead, they are assigned a content-steering pathway and managed by the content-steering controller. Fallback behavior is then performed by switching pathways rather than setting level ids. More information about this change can be found in #5970. Can you provide a specific example of when you remove a redundant level (and why)? |
We have a custom error handling logic. We wrote the code which retrying level loading in case 404 or other error code severals time with delay, after that it remove url and go to fallback. const removeDamagedStream = (levelIndex: number, currentUrl?: string) => {
const levels = newHls?.levels || [];
const currentDetails = levels[levelIndex]?.details;
const url = currentUrl || currentDetails?.url || levels[levelIndex].uri;
const urls = levels[levelIndex].url ?? [];
for (let i = 0; i < urls.length; i++) {
if (urls[i] === url) {
for (let j = 0; j < levels.length; j++) {
if (levels[j]?.url && levels[j].url.length > i) {
newHls?.removeLevel(j, i);
}
}
}
}
};
if (data.type === Hls.ErrorTypes.NETWORK_ERROR && data.details === Hls.ErrorDetails.LEVEL_LOAD_ERROR) {
const currentLevel = data.context?.level && data.context?.level >= 0 ? data.context?.level : 0;
if (hls?.levels[currentLevel].url.length === 1 && retryConfig && typeof retryConfig.maxNumRetry === 'number') {
newHls?.stopLoad();
const timeoutCb = () => {
newHls?.startLoad();
typeof retryConfig.maxNumRetry === 'number' && retryConfig.maxNumRetry--;
};
retryConfig.maxNumRetry > 0 && setTimeout(timeoutCb, retryConfig?.retryDelayMs);
} else {
removeDamagedStream(currentLevel);
}
} |
I'll search for content-steering and rewrite our errorHandling |
The error handling path runs through retries until no retries or alternates are available before setting error handling action and flags: hls.js/src/controller/error-controller.ts Lines 167 to 170 in 970eb9e
hls.js/src/controller/error-controller.ts Lines 252 to 273 in 970eb9e
hls.js/src/controller/error-controller.ts Line 327 in 970eb9e
hls.js/src/controller/error-controller.ts Lines 435 to 439 in 970eb9e
These flags signal to content-steering that a pathway change is appropriate: hls.js/src/controller/content-steering-controller.ts Lines 176 to 204 in 970eb9e
|
There is no public API to update Pathway priority - it is only performed on error or HLS Content Steering Manifest change. If the built-in error handling is not working for you please describe how. Some of the features you may be interested in contributing:
|
Thank you for answer. |
If you remove all levels with Pathway ".", I would expect HLS.js to change the Pathway to "..", and then fire LEVELS_UPDATED with levels set to have all the redundant levels in Pathway "..". However, this has not been tested. It likely will not work without some changes to the code base. Let me know if this is something you would like. The only way for you know from the player API that new Pathways were assigned would be to inspect the parsed hls.js/src/controller/level-controller.ts Lines 177 to 178 in 5eba01c
|
I rewrite logic with custom |
What do you want to do with Hls.js?
In 1.5.0
hls.removeLevel
support of deleting level by url id was removed.We using it in our player. Can I return this support in hls or it's not necessary in your vision?
What have you tried so far?
No response
The text was updated successfully, but these errors were encountered: