From 3fb7c7015556f7d49ad27c577ca09ad9afef68db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Sun, 20 Jan 2019 21:46:30 +0800 Subject: [PATCH] Enhancement: twitter animated_gif autoplay (#1426) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `media.type` 为 `animated_gif` 时自动循环播放视频,普通视频(`video`)维持原状 - 具体表现与阅读器(或者说是浏览器内核)有关,有些确实不支持自动播放,可以参考[这个](https://imququ.com/post/new-video-policies-for-ios10.html) - Closes #1421 --- lib/routes/twitter/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/routes/twitter/utils.js b/lib/routes/twitter/utils.js index b97cf990d4..de39f9188b 100644 --- a/lib/routes/twitter/utils.js +++ b/lib/routes/twitter/utils.js @@ -36,7 +36,8 @@ const ProcessFeed = ({ data = [] }) => { }, {}); if (video.url) { - content = `
`; + const gifAutoPlayAttr = media.type === 'animated_gif' ? `autoplay loop muted webkit-playsinline playsinline` : ''; + content = `
`; } return content;