Add support for 'listen=1'

This commit is contained in:
Omar Roth 2018-08-04 20:27:53 -05:00
parent 738e1a5415
commit 3b01bc6735
2 changed files with 6 additions and 6 deletions

View File

@ -221,7 +221,7 @@ get "/watch" do |env|
end
video_end ||= -1
if env.params.query["listen"]? && env.params.query["listen"] == "true"
if env.params.query["listen"]? && env.params.query["listen"] == "true" || env.params.query["listen"] == "1"
listen = true
env.params.query.delete_all("listen")
end
@ -381,7 +381,7 @@ get "/embed/:id" do |env|
end
video_end ||= -1
if env.params.query["listen"]? && env.params.query["listen"] == "true"
if env.params.query["listen"]? && env.params.query["listen"] == "true" || env.params.query["listen"] == "1"
listen = true
env.params.query.delete_all("listen")
end

View File

@ -49,14 +49,14 @@
<% else %>
<% if listen %>
<% audio_streams.each_with_index do |fmt, i| %>
<source src="<%= fmt["url"] %>" type="<%= fmt["type"] %>" label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
<% end %>
<% else %>
<% fmt_stream.each_with_index do |fmt, i| %>
<% if preferences %>
<source src="<%= fmt["url"] %>" type="<%= fmt["type"] %>" label="<%= fmt["label"] %>" selected="<%= preferences.quality == fmt["label"].split(" - ")[0] %>">
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= preferences.quality == fmt["label"].split(" - ")[0] %>">
<% else %>
<source src="<%= fmt["url"] %>" type="<%= fmt["type"] %>" label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>">
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>">
<% end %>
<% end %>
@ -327,7 +327,7 @@ get_youtube_comments();
<i class="icon ion-ios-videocam"></i>
</a>
<% else %>
<a href="/watch?<%= env.params.query %>&listen=true">
<a href="/watch?<%= env.params.query %>&listen=1">
<i class="icon ion-ios-volume-high"></i>
</a>
<% end %>