1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Code cleanup

This commit is contained in:
gnattu 2024-09-14 17:06:37 +08:00
parent 4c3095412b
commit 16a1416521

View file

@ -1,12 +1,8 @@
import minBy from 'lodash-es/minBy';
import { appHost } from '../components/apphost';
import globalize from '../lib/globalize';
import appSettings from '../scripts/settings/appSettings';
export function getVideoQualityOptions(options) {
const maxStreamingBitrate = options.currentMaxBitrate;
let videoWidth = options.videoWidth;
const videoHeight = options.videoHeight;
const videoBitRate = options.videoBitRate ?? -1;
// Quality options are indexed by bitrate. If you must duplicate them, make sure each of them are unique (by making the last digit a 1)
@ -25,8 +21,8 @@ export function getVideoQualityOptions(options) {
{ name: '3 Mbps', maxHeight: 720, bitrate: 3000000 },
{ name: '1.5 Mbps', maxHeight: 720, bitrate: 1500000 },
{ name: '720 kbps', maxHeight: 480, bitrate: 720000 },
{ name: '420 kbps', maxHeight: 360, bitrate: 420000 },
]
{ name: '420 kbps', maxHeight: 360, bitrate: 420000 }
];
const qualityOptions = [];
@ -47,9 +43,7 @@ export function getVideoQualityOptions(options) {
}
bitrateConfigurations.forEach((c) => {
if (videoBitRate > 0 && c.bitrate < videoBitRate) {
qualityOptions.push(c);
} else if (videoBitRate < 0) {
if (videoBitRate < 0 || (videoBitRate > 0 && c.bitrate < videoBitRate)) {
qualityOptions.push(c);
}
})