From 549fc77bccb9204e732ecadec6df4c7e4350ce46 Mon Sep 17 00:00:00 2001 From: 138138138 <78271024+138138138@users.noreply.github.com> Date: Wed, 22 Jun 2022 22:04:25 +0800 Subject: [PATCH] Select audio quality according to video quality Currently 64k m4a is selected as default. This sounds very bad to users with enough bandwidth. The code assigns medium, small, dash 240p, dash 1440p, dash worst to 64k m4a. Others will be 128k m4a. --- src/invidious/views/components/player.ecr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr index fffefc9a..cb029509 100644 --- a/src/invidious/views/components/player.ecr +++ b/src/invidious/views/components/player.ecr @@ -14,7 +14,10 @@ bitrate = fmt["bitrate"] mimetype = HTML.escape(fmt["mimeType"].as_s) - selected = i == 0 ? true : false + # select audio quality according to video quality. 0 is 64k m4a, 1 is 128k m4a. + qy = params.quality + qyd = params.quality_dash + selected = i == (qy == "medium" || qy == "small" || (qy == "dash" && (qyd == "240p" || qyd == "144p" || qyd == "worst")) ? 0 : 1) %> <% if !params.local && !CONFIG.disabled?("local") %>