From 068a227397ff99949f2b11cb1e94e9e940e5b52d Mon Sep 17 00:00:00 2001 From: sparky8251 Date: Sat, 17 Oct 2020 20:06:20 -0400 Subject: [PATCH 1/4] Removed excess quality options to make menu more manageable --- src/components/qualityOptions.js | 95 ++++++++++++-------------------- 1 file changed, 35 insertions(+), 60 deletions(-) diff --git a/src/components/qualityOptions.js b/src/components/qualityOptions.js index 93a8d5fe73..098ced3aeb 100644 --- a/src/components/qualityOptions.js +++ b/src/components/qualityOptions.js @@ -15,56 +15,6 @@ export function getVideoQualityOptions(options) { const qualityOptions = []; - if (maxAllowedWidth >= 3800) { - qualityOptions.push({ name: '4K - 120 Mbps', maxHeight: 2160, bitrate: 120000000 }); - qualityOptions.push({ name: '4K - 100 Mbps', maxHeight: 2160, bitrate: 100000000 }); - qualityOptions.push({ name: '4K - 80 Mbps', maxHeight: 2160, bitrate: 80000000 }); - } - - // Some 1080- videos are reported as 1912? - if (maxAllowedWidth >= 1900) { - qualityOptions.push({ name: '1080p - 60 Mbps', maxHeight: 1080, bitrate: 60000000 }); - qualityOptions.push({ name: '1080p - 50 Mbps', maxHeight: 1080, bitrate: 50000000 }); - qualityOptions.push({ name: '1080p - 40 Mbps', maxHeight: 1080, bitrate: 40000000 }); - qualityOptions.push({ name: '1080p - 30 Mbps', maxHeight: 1080, bitrate: 30000000 }); - qualityOptions.push({ name: '1080p - 25 Mbps', maxHeight: 1080, bitrate: 25000000 }); - qualityOptions.push({ name: '1080p - 20 Mbps', maxHeight: 1080, bitrate: 20000000 }); - qualityOptions.push({ name: '1080p - 15 Mbps', maxHeight: 1080, bitrate: 15000000 }); - qualityOptions.push({ name: '1080p - 10 Mbps', maxHeight: 1080, bitrate: 10000001 }); - qualityOptions.push({ name: '1080p - 8 Mbps', maxHeight: 1080, bitrate: 8000001 }); - qualityOptions.push({ name: '1080p - 6 Mbps', maxHeight: 1080, bitrate: 6000001 }); - qualityOptions.push({ name: '1080p - 5 Mbps', maxHeight: 1080, bitrate: 5000001 }); - qualityOptions.push({ name: '1080p - 4 Mbps', maxHeight: 1080, bitrate: 4000002 }); - } else if (maxAllowedWidth >= 1260) { - qualityOptions.push({ name: '720p - 10 Mbps', maxHeight: 720, bitrate: 10000000 }); - qualityOptions.push({ name: '720p - 8 Mbps', maxHeight: 720, bitrate: 8000000 }); - qualityOptions.push({ name: '720p - 6 Mbps', maxHeight: 720, bitrate: 6000000 }); - qualityOptions.push({ name: '720p - 5 Mbps', maxHeight: 720, bitrate: 5000000 }); - } else if (maxAllowedWidth >= 620) { - qualityOptions.push({ name: '480p - 4 Mbps', maxHeight: 480, bitrate: 4000001 }); - qualityOptions.push({ name: '480p - 3 Mbps', maxHeight: 480, bitrate: 3000001 }); - qualityOptions.push({ name: '480p - 2.5 Mbps', maxHeight: 480, bitrate: 2500000 }); - qualityOptions.push({ name: '480p - 2 Mbps', maxHeight: 480, bitrate: 2000001 }); - qualityOptions.push({ name: '480p - 1.5 Mbps', maxHeight: 480, bitrate: 1500001 }); - } - - if (maxAllowedWidth >= 1260) { - qualityOptions.push({ name: '720p - 4 Mbps', maxHeight: 720, bitrate: 4000000 }); - qualityOptions.push({ name: '720p - 3 Mbps', maxHeight: 720, bitrate: 3000000 }); - qualityOptions.push({ name: '720p - 2 Mbps', maxHeight: 720, bitrate: 2000000 }); - - // The extra 1 is because they're keyed off the bitrate value - qualityOptions.push({ name: '720p - 1.5 Mbps', maxHeight: 720, bitrate: 1500000 }); - qualityOptions.push({ name: '720p - 1 Mbps', maxHeight: 720, bitrate: 1000001 }); - } - - qualityOptions.push({ name: '480p - 1 Mbps', maxHeight: 480, bitrate: 1000000 }); - qualityOptions.push({ name: '480p - 720 kbps', maxHeight: 480, bitrate: 720000 }); - qualityOptions.push({ name: '480p - 420 kbps', maxHeight: 480, bitrate: 420000 }); - qualityOptions.push({ name: '360p', maxHeight: 360, bitrate: 400000 }); - qualityOptions.push({ name: '240p', maxHeight: 240, bitrate: 320000 }); - qualityOptions.push({ name: '144p', maxHeight: 144, bitrate: 192000 }); - const autoQualityOption = { name: globalize.translate('Auto'), bitrate: 0, @@ -75,6 +25,31 @@ export function getVideoQualityOptions(options) { qualityOptions.push(autoQualityOption); } + // 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) + if (maxAllowedWidth >= 3800) { + qualityOptions.push({ name: '4K - 120 Mbps', maxHeight: 2160, bitrate: 120000000 }); + qualityOptions.push({ name: '4K - 80 Mbps', maxHeight: 2160, bitrate: 80000000 }); + } + if (maxAllowedWidth >= 1900) { // Some 1080- videos are reported as 1912? + qualityOptions.push({ name: '1080p - 60 Mbps', maxHeight: 1080, bitrate: 60000000 }); + qualityOptions.push({ name: '1080p - 40 Mbps', maxHeight: 1080, bitrate: 40000000 }); + qualityOptions.push({ name: '1080p - 20 Mbps', maxHeight: 1080, bitrate: 20000000 }); + qualityOptions.push({ name: '1080p - 15 Mbps', maxHeight: 1080, bitrate: 15000000 }); + qualityOptions.push({ name: '1080p - 10 Mbps', maxHeight: 1080, bitrate: 10000000 }); + } + if (maxAllowedWidth >= 1260) { + qualityOptions.push({ name: '720p - 8 Mbps', maxHeight: 720, bitrate: 8000000 }); + qualityOptions.push({ name: '720p - 6 Mbps', maxHeight: 720, bitrate: 6000000 }); + qualityOptions.push({ name: '720p - 3 Mbps', maxHeight: 720, bitrate: 3000000 }); + } + if (maxAllowedWidth >= 620) { + qualityOptions.push({ name: '480p - 1.5 Mbps', maxHeight: 480, bitrate: 1500000 }); + qualityOptions.push({ name: '480p - 720 kbps', maxHeight: 480, bitrate: 720000 }); + qualityOptions.push({ name: '480p - 420 kbps', maxHeight: 480, bitrate: 420000 }); + } + + qualityOptions.push({ name: '360p - 360 kbps', maxHeight: 360, bitrate: 360000 }); + if (maxStreamingBitrate) { let selectedIndex = -1; for (let i = 0, length = qualityOptions.length; i < length; i++) { @@ -106,16 +81,6 @@ export function getAudioQualityOptions(options) { const qualityOptions = []; - qualityOptions.push({ name: '2 Mbps', bitrate: 2000000 }); - qualityOptions.push({ name: '1.5 Mbps', bitrate: 1500000 }); - qualityOptions.push({ name: '1 Mbps', bitrate: 1000000 }); - qualityOptions.push({ name: '320 kbps', bitrate: 320000 }); - qualityOptions.push({ name: '256 kbps', bitrate: 256000 }); - qualityOptions.push({ name: '192 kbps', bitrate: 192000 }); - qualityOptions.push({ name: '128 kbps', bitrate: 128000 }); - qualityOptions.push({ name: '96 kbps', bitrate: 96000 }); - qualityOptions.push({ name: '64 kbps', bitrate: 64000 }); - const autoQualityOption = { name: globalize.translate('Auto'), bitrate: 0, @@ -126,6 +91,16 @@ export function getAudioQualityOptions(options) { qualityOptions.push(autoQualityOption); } + qualityOptions.push({ name: '2 Mbps', bitrate: 2000000 }); + qualityOptions.push({ name: '1.5 Mbps', bitrate: 1500000 }); + qualityOptions.push({ name: '1 Mbps', bitrate: 1000000 }); + qualityOptions.push({ name: '320 kbps', bitrate: 320000 }); + qualityOptions.push({ name: '256 kbps', bitrate: 256000 }); + qualityOptions.push({ name: '192 kbps', bitrate: 192000 }); + qualityOptions.push({ name: '128 kbps', bitrate: 128000 }); + qualityOptions.push({ name: '96 kbps', bitrate: 96000 }); + qualityOptions.push({ name: '64 kbps', bitrate: 64000 }); + if (maxStreamingBitrate) { let selectedIndex = -1; for (let i = 0, length = qualityOptions.length; i < length; i++) { From cca60511d0ffbc499a4e2d2c007034b39f38862b Mon Sep 17 00:00:00 2001 From: sparky8251 Date: Sat, 17 Oct 2020 20:21:44 -0400 Subject: [PATCH 2/4] Please Mr Linter? --- src/components/qualityOptions.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/qualityOptions.js b/src/components/qualityOptions.js index 098ced3aeb..29e8e3d580 100644 --- a/src/components/qualityOptions.js +++ b/src/components/qualityOptions.js @@ -30,18 +30,19 @@ export function getVideoQualityOptions(options) { qualityOptions.push({ name: '4K - 120 Mbps', maxHeight: 2160, bitrate: 120000000 }); qualityOptions.push({ name: '4K - 80 Mbps', maxHeight: 2160, bitrate: 80000000 }); } - if (maxAllowedWidth >= 1900) { // Some 1080- videos are reported as 1912? + // Some 1080- videos are reported as 1912? + if (maxAllowedWidth >= 1900) { qualityOptions.push({ name: '1080p - 60 Mbps', maxHeight: 1080, bitrate: 60000000 }); qualityOptions.push({ name: '1080p - 40 Mbps', maxHeight: 1080, bitrate: 40000000 }); qualityOptions.push({ name: '1080p - 20 Mbps', maxHeight: 1080, bitrate: 20000000 }); qualityOptions.push({ name: '1080p - 15 Mbps', maxHeight: 1080, bitrate: 15000000 }); qualityOptions.push({ name: '1080p - 10 Mbps', maxHeight: 1080, bitrate: 10000000 }); - } + } if (maxAllowedWidth >= 1260) { qualityOptions.push({ name: '720p - 8 Mbps', maxHeight: 720, bitrate: 8000000 }); qualityOptions.push({ name: '720p - 6 Mbps', maxHeight: 720, bitrate: 6000000 }); qualityOptions.push({ name: '720p - 3 Mbps', maxHeight: 720, bitrate: 3000000 }); - } + } if (maxAllowedWidth >= 620) { qualityOptions.push({ name: '480p - 1.5 Mbps', maxHeight: 480, bitrate: 1500000 }); qualityOptions.push({ name: '480p - 720 kbps', maxHeight: 480, bitrate: 720000 }); From 4971a90947f2ce8283c196f56f18287cebf3ac97 Mon Sep 17 00:00:00 2001 From: sparky8251 Date: Mon, 30 Nov 2020 11:52:13 -0500 Subject: [PATCH 3/4] Address comments --- src/components/qualityOptions.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/qualityOptions.js b/src/components/qualityOptions.js index 29e8e3d580..9a807e24a0 100644 --- a/src/components/qualityOptions.js +++ b/src/components/qualityOptions.js @@ -41,15 +41,15 @@ export function getVideoQualityOptions(options) { if (maxAllowedWidth >= 1260) { qualityOptions.push({ name: '720p - 8 Mbps', maxHeight: 720, bitrate: 8000000 }); qualityOptions.push({ name: '720p - 6 Mbps', maxHeight: 720, bitrate: 6000000 }); - qualityOptions.push({ name: '720p - 3 Mbps', maxHeight: 720, bitrate: 3000000 }); + qualityOptions.push({ name: '720p - 4 Mbps', maxHeight: 720, bitrate: 3000000 }); } if (maxAllowedWidth >= 620) { + qualityOptions.push({ name: '480p - 3 Mbps', maxHeight: 480, bitrate: 3000000 }); qualityOptions.push({ name: '480p - 1.5 Mbps', maxHeight: 480, bitrate: 1500000 }); qualityOptions.push({ name: '480p - 720 kbps', maxHeight: 480, bitrate: 720000 }); - qualityOptions.push({ name: '480p - 420 kbps', maxHeight: 480, bitrate: 420000 }); } - qualityOptions.push({ name: '360p - 360 kbps', maxHeight: 360, bitrate: 360000 }); + qualityOptions.push({ name: '360p - 420 kbps', maxHeight: 360, bitrate: 420000 }); if (maxStreamingBitrate) { let selectedIndex = -1; From 78278223892676ae205198f900ddb4da421b0f07 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 2 Dec 2020 11:16:28 -0500 Subject: [PATCH 4/4] Fix 4Mbps value --- src/components/qualityOptions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/qualityOptions.js b/src/components/qualityOptions.js index 9a807e24a0..009785d5a6 100644 --- a/src/components/qualityOptions.js +++ b/src/components/qualityOptions.js @@ -41,7 +41,7 @@ export function getVideoQualityOptions(options) { if (maxAllowedWidth >= 1260) { qualityOptions.push({ name: '720p - 8 Mbps', maxHeight: 720, bitrate: 8000000 }); qualityOptions.push({ name: '720p - 6 Mbps', maxHeight: 720, bitrate: 6000000 }); - qualityOptions.push({ name: '720p - 4 Mbps', maxHeight: 720, bitrate: 3000000 }); + qualityOptions.push({ name: '720p - 4 Mbps', maxHeight: 720, bitrate: 4000000 }); } if (maxAllowedWidth >= 620) { qualityOptions.push({ name: '480p - 3 Mbps', maxHeight: 480, bitrate: 3000000 });