Mercurial > rsstweet
changeset 178:38598ae5a8f6
Sort video url by bitrate
author | nanaya <me@nanaya.pro> |
---|---|
date | Sat, 13 Oct 2018 14:26:25 +0900 |
parents | 3176bd0d3c2c |
children | b224cf75a759 |
files | app/views/tweets/_tweet.html.erb |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 %> </p>