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:
parent
05b91a7102
commit
699af63583
2 changed files with 13 additions and 7 deletions
16
api/video.js
16
api/video.js
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue