2022-08-11 17:54:56 +02:00
|
|
|
From a5b4cf207d3942963d8d7553ec3d6cd36bdc41fc Mon Sep 17 00:00:00 2001
|
2021-09-08 18:23:21 +02:00
|
|
|
From: Simon Bruder <simon@sbruder.de>
|
|
|
|
Date: Thu, 9 Sep 2021 16:56:57 +0200
|
|
|
|
Subject: [PATCH] Prefer opus audio streams in listen mode
|
|
|
|
|
|
|
|
---
|
2022-07-23 20:01:22 +02:00
|
|
|
src/invidious/views/components/player.ecr | 14 +++++++-------
|
|
|
|
1 file changed, 7 insertions(+), 7 deletions(-)
|
2021-09-08 18:23:21 +02:00
|
|
|
|
|
|
|
diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr
|
2022-08-11 17:54:56 +02:00
|
|
|
index c3c02df0..82c89500 100644
|
2021-09-08 18:23:21 +02:00
|
|
|
--- a/src/invidious/views/components/player.ecr
|
|
|
|
+++ b/src/invidious/views/components/player.ecr
|
2022-07-23 20:01:22 +02:00
|
|
|
@@ -7,14 +7,14 @@
|
2021-09-08 18:23:21 +02:00
|
|
|
<source src="<%= URI.parse(hlsvp).request_target %><% if params.local %>?local=true<% end %>" type="application/x-mpegURL" label="livestream">
|
|
|
|
<% else %>
|
|
|
|
<% if params.listen %>
|
2022-07-23 20:01:22 +02:00
|
|
|
- <% # default to 128k m4a stream
|
|
|
|
- best_m4a_stream_index = 0
|
|
|
|
- best_m4a_stream_bitrate = 0
|
|
|
|
+ <% # default to 128k opus stream
|
|
|
|
+ best_opus_stream_index = 0
|
|
|
|
+ best_opus_stream_bitrate = 0
|
|
|
|
audio_streams.each_with_index do |fmt, i|
|
|
|
|
bandwidth = fmt["bitrate"].as_i
|
|
|
|
- if (fmt["mimeType"].as_s.starts_with?("audio/mp4") && bandwidth > best_m4a_stream_bitrate)
|
|
|
|
- best_m4a_stream_bitrate = bandwidth
|
|
|
|
- best_m4a_stream_index = i
|
2022-08-11 17:54:56 +02:00
|
|
|
+ if (fmt["mimeType"].as_s.starts_with?("audio/webm") && bandwidth > best_opus_stream_bitrate)
|
2022-07-23 20:01:22 +02:00
|
|
|
+ best_opus_stream_bitrate = bandwidth
|
|
|
|
+ best_opus_stream_index = i
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
@@ -25,7 +25,7 @@
|
|
|
|
bitrate = fmt["bitrate"]
|
|
|
|
mimetype = HTML.escape(fmt["mimeType"].as_s)
|
|
|
|
|
|
|
|
- selected = (i == best_m4a_stream_index)
|
|
|
|
+ selected = (i == best_opus_stream_index)
|
|
|
|
%>
|
|
|
|
<source src="<%= src_url %>" type='<%= mimetype %>' label="<%= bitrate %>k" selected="<%= selected %>">
|
|
|
|
<% if !params.local && !CONFIG.disabled?("local") %>
|
2021-09-08 18:23:21 +02:00
|
|
|
--
|
2022-07-23 20:01:22 +02:00
|
|
|
2.36.0
|
2021-09-08 18:23:21 +02:00
|
|
|
|