# HG changeset patch # User nanaya # Date 1539408385 -32400 # Node ID 38598ae5a8f617c5cb5da7a4b7a08e0088c9e44f # Parent 3176bd0d3c2cefd0bb12b18745e7d424d85ca571 Sort video url by bitrate diff -r 3176bd0d3c2c -r 38598ae5a8f6 app/views/tweets/_tweet.html.erb --- a/app/views/tweets/_tweet.html.erb Sat Oct 13 00:48:05 2018 +0900 +++ b/app/views/tweets/_tweet.html.erb Sat Oct 13 14:26:25 2018 +0900 @@ -37,7 +37,11 @@ <%= image_tag "#{media.media_url_https}:small", :alt => "attachment #{i + 1}" -%> <% end %> <% elsif media.is_a? Twitter::Media::Video %> - <%= video_tag media.video_info.variants.map(&:url), width: '100%', controls: true %> + <%= video_tag media.video_info.variants + .select { |i| i.bitrate.is_a? Integer } + .sort_by { |i| -i.bitrate } + .map(&:url), width: '100%', controls: true + %> <% end %> <% end %>