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

Fix VideoQuality.fromLabel to match higher resolutions first #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jamiepiccolo
Copy link

@jamiepiccolo jamiepiccolo commented Sep 8, 2023

VideoQuality.fromLabel would give incorrect qualities in some cases.

An example being the 1440p label where the method would assign VideoQuality.low144 because of a premature match of the string's prefix "144":

if (label.startsWith('144')) {
    return VideoQuality.low144;
}

...

if (label.startsWith('1440')) {
    return VideoQuality.high1440;
}

I simply reversed the resolution map and looped over it so that we start matching from the highest resolution first.

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

Successfully merging this pull request may close these issues.

None yet

1 participant