comparison app/views/tweets/_tweet.html.erb @ 178:38598ae5a8f6

Sort video url by bitrate
author nanaya <me@nanaya.pro>
date Sat, 13 Oct 2018 14:26:25 +0900
parents d35dbc09bd83
children 7b1bdf697063
comparison
equal deleted inserted replaced
177:3176bd0d3c2c 178:38598ae5a8f6
35 <% if media.is_a? Twitter::Media::Photo %> 35 <% if media.is_a? Twitter::Media::Photo %>
36 <%= link_to "#{media.media_url_https}:orig" do %> 36 <%= link_to "#{media.media_url_https}:orig" do %>
37 <%= image_tag "#{media.media_url_https}:small", :alt => "attachment #{i + 1}" -%> 37 <%= image_tag "#{media.media_url_https}:small", :alt => "attachment #{i + 1}" -%>
38 <% end %> 38 <% end %>
39 <% elsif media.is_a? Twitter::Media::Video %> 39 <% elsif media.is_a? Twitter::Media::Video %>
40 <%= video_tag media.video_info.variants.map(&:url), width: '100%', controls: true %> 40 <%= video_tag media.video_info.variants
41 .select { |i| i.bitrate.is_a? Integer }
42 .sort_by { |i| -i.bitrate }
43 .map(&:url), width: '100%', controls: true
44 %>
41 <% end %> 45 <% end %>
42 <% end %> 46 <% end %>
43 </p> 47 </p>
44 48
45 <% if tweet.quoted_status.present? %> 49 <% if tweet.quoted_status.present? %>