mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-12 15:48:31 +00:00
Clean the player's <source> list generation code
This commit is contained in:
parent
c71dc61221
commit
c03d731c23
@ -10,17 +10,22 @@
|
|||||||
<% audio_streams.each_with_index do |fmt, i| %>
|
<% audio_streams.each_with_index do |fmt, i| %>
|
||||||
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["mimeType"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
|
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["mimeType"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if params.quality == "dash" %>
|
<% if params.quality == "dash" %>
|
||||||
<source src="/api/manifest/dash/id/<%= video.id %>?local=true&unique_res=1" type='application/dash+xml' label="dash">
|
<source src="/api/manifest/dash/id/<%= video.id %>?local=true&unique_res=1" type='application/dash+xml' label="dash">
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% fmt_stream.each_with_index do |fmt, i| %>
|
<%
|
||||||
<% if params.quality %>
|
fmt_stream.each_with_index do |fmt, i|
|
||||||
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["mimeType"] %>' label="<%= fmt["quality"] %>" selected="<%= params.quality == fmt["quality"] %>">
|
src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}"
|
||||||
<% else %>
|
src_url += "&local=true" if params.local
|
||||||
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["mimeType"] %>' label="<%= fmt["quality"] %>" selected="<%= i == 0 ? true : false %>">
|
|
||||||
<% end %>
|
quality = fmt["quality"]
|
||||||
|
mimetype = fmt["mimeType"]
|
||||||
|
|
||||||
|
selected = params.quality ? (params.quality == quality) : (i == 0)
|
||||||
|
%>
|
||||||
|
<source src="<%= src_url %>" type="<%= mimetype %>" label="<%= quality %>" selected="<%= selected %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user