Merge pull request #2171 from nyanmisaka/fix-auto

Fix the issue where the bitrate option is always Auto
This commit is contained in:
dkanada 2020-12-04 23:18:09 +09:00 committed by GitHub
commit 49d6d0432e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,19 +52,16 @@ export function getVideoQualityOptions(options) {
qualityOptions.push({ name: '360p - 420 kbps', maxHeight: 360, bitrate: 420000 });
if (maxStreamingBitrate) {
let selectedIndex = -1;
let selectedIndex = qualityOptions.length - 1;
for (let i = 0, length = qualityOptions.length; i < length; i++) {
const option = qualityOptions[i];
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
if (option.bitrate > 0 && option.bitrate <= maxStreamingBitrate) {
selectedIndex = i;
break;
}
}
if (selectedIndex === -1) {
selectedIndex = qualityOptions.length - 1;
}
const currentQualityOption = qualityOptions[selectedIndex];
if (!options.isAutomaticBitrateEnabled) {
@ -103,19 +100,16 @@ export function getAudioQualityOptions(options) {
qualityOptions.push({ name: '64 kbps', bitrate: 64000 });
if (maxStreamingBitrate) {
let selectedIndex = -1;
let selectedIndex = qualityOptions.length - 1;
for (let i = 0, length = qualityOptions.length; i < length; i++) {
const option = qualityOptions[i];
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
if (option.bitrate > 0 && option.bitrate <= maxStreamingBitrate) {
selectedIndex = i;
break;
}
}
if (selectedIndex === -1) {
selectedIndex = qualityOptions.length - 1;
}
const currentQualityOption = qualityOptions[selectedIndex];
if (!options.isAutomaticBitrateEnabled) {