mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-20 21:24:42 -05:00
Highest quality m4a on audio only mode as default
Audio mode will automatically select highest quality m4a as default.
This commit is contained in:
parent
140b6c1227
commit
81abebd144
@ -7,14 +7,25 @@
|
|||||||
<source src="<%= URI.parse(hlsvp).request_target %><% if params.local %>?local=true<% end %>" type="application/x-mpegURL" label="livestream">
|
<source src="<%= URI.parse(hlsvp).request_target %><% if params.local %>?local=true<% end %>" type="application/x-mpegURL" label="livestream">
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if params.listen %>
|
<% if params.listen %>
|
||||||
<% audio_streams.each_with_index do |fmt, i|
|
<% # ignore the 64k m4a stream, only consider the 128k m4a stream
|
||||||
|
best_m4a_stream_index = 0
|
||||||
|
best_m4a_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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
audio_streams.each_with_index do |fmt, i|
|
||||||
src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}"
|
src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}"
|
||||||
src_url += "&local=true" if params.local
|
src_url += "&local=true" if params.local
|
||||||
|
|
||||||
bitrate = fmt["bitrate"]
|
bitrate = fmt["bitrate"]
|
||||||
mimetype = HTML.escape(fmt["mimeType"].as_s)
|
mimetype = HTML.escape(fmt["mimeType"].as_s)
|
||||||
|
|
||||||
selected = i == 0 ? true : false
|
selected = i == best_m4a_stream_index ? true : false
|
||||||
%>
|
%>
|
||||||
<source src="<%= src_url %>" type='<%= mimetype %>' label="<%= bitrate %>k" selected="<%= selected %>">
|
<source src="<%= src_url %>" type='<%= mimetype %>' label="<%= bitrate %>k" selected="<%= selected %>">
|
||||||
<% if !params.local && !CONFIG.disabled?("local") %>
|
<% if !params.local && !CONFIG.disabled?("local") %>
|
||||||
|
Loading…
Reference in New Issue
Block a user