1
0
Fork 0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2026-03-02 10:41:36 +00:00

Update "preferred quality" setting

- Re-order the options on the settings page
- "best" and "best <= 1080p" now prefer high-fps
This commit is contained in:
Cadence Ember 2021-04-25 22:13:04 +12:00
parent 05b91a7102
commit 699af63583
No known key found for this signature in database
GPG key ID: BC1C2C61CF521B17
2 changed files with 13 additions and 7 deletions

View file

@ -52,15 +52,21 @@ function sortFormats(video, preference) {
}
if (preference === 1) { // best dash
formats.sort((a, b) => (b.second__height - a.second__height))
formats.sort((a, b) => {
const a1 = a.second__height + a.fps / 100
const b1 = b.second__height + b.fps / 100
return b1 - a1
})
} else if (preference === 2) { // best <=1080p
formats.sort((a, b) => {
if (b.second__height > 1080) {
if (a.second__height > 1080) return b.second__height - a.second__height
const a1 = a.second__height + a.fps / 100
const b1 = b.second__height + b.fps / 100
if (b1 > 1081) {
if (a1 > 1081) return b1 - a1
return -1
}
if (a.second__height > 1080) return 1
return b.second__height - a.second__height
if (a1 > 1081) return 1
return b1 - a1
})
} else if (preference === 3) { // best low-fps
formats.sort((a, b) => {