FEATURE: Autoplay oneboxed twitter GIF media
This commit is contained in:
parent
5f7839f0a4
commit
eb981b8fbb
|
@ -33,14 +33,29 @@ class TwitterApi
|
||||||
width = m['sizes']['large']['w']
|
width = m['sizes']['large']['w']
|
||||||
height = m['sizes']['large']['h']
|
height = m['sizes']['large']['h']
|
||||||
|
|
||||||
|
attributes =
|
||||||
|
if m['type'] == 'animated_gif'
|
||||||
|
%w{
|
||||||
|
loop
|
||||||
|
muted
|
||||||
|
autoplay
|
||||||
|
disableRemotePlayback
|
||||||
|
disablePictureInPicture
|
||||||
|
}
|
||||||
|
else
|
||||||
|
%w{
|
||||||
|
controls
|
||||||
|
playsinline
|
||||||
|
}
|
||||||
|
end.join(' ')
|
||||||
|
|
||||||
result << <<~HTML
|
result << <<~HTML
|
||||||
<div class='tweet-images'>
|
<div class='tweet-images'>
|
||||||
<div class='aspect-image-full-size' style='--aspect-ratio:#{width}/#{height};'>
|
<div class='aspect-image-full-size' style='--aspect-ratio:#{width}/#{height};'>
|
||||||
<video class='tweet-video' controls playsinline
|
<video class='tweet-video' #{attributes}
|
||||||
width='#{width}'
|
width='#{width}'
|
||||||
height='#{height}'
|
height='#{height}'
|
||||||
poster='#{m['media_url_https']}'
|
poster='#{m['media_url_https']}'>
|
||||||
#{'loop' if m['type'] == 'animated_gif'}>
|
|
||||||
<source src='#{url}' type="video/mp4">
|
<source src='#{url}' type="video/mp4">
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue