diff --git a/Account/Sources/Account/FeedProvider/Twitter/TwitterExtendedMedia.swift b/Account/Sources/Account/FeedProvider/Twitter/TwitterExtendedMedia.swift index 2ee2b3454..614fd5438 100644 --- a/Account/Sources/Account/FeedProvider/Twitter/TwitterExtendedMedia.swift +++ b/Account/Sources/Account/FeedProvider/Twitter/TwitterExtendedMedia.swift @@ -36,8 +36,10 @@ struct TwitterExtendedMedia: Codable { switch type { case "photo": html += renderPhotoAsHTML() - case "video", "animated_gif": + case "video": html += renderVideoAsHTML() + case "animated_gif": + html += renderAnimatedGIFAsHTML() default: break } @@ -74,6 +76,21 @@ private extension TwitterExtendedMedia { return html } + func renderAnimatedGIFAsHTML() -> String { + guard let bestVariantURL = findBestVariant()?.url else { return "" } + + var html = "" + return html + } + func findBestVariant() -> TwitterVideo.Variant? { var best: TwitterVideo.Variant? = nil if let variants = video?.variants { diff --git a/Shared/Article Rendering/main.js b/Shared/Article Rendering/main.js index 184df9008..befc09c0d 100644 --- a/Shared/Article Rendering/main.js +++ b/Shared/Article Rendering/main.js @@ -53,7 +53,9 @@ function wrapTables() { function inlineVideos() { document.querySelectorAll("video").forEach(element => { element.setAttribute("playsinline", true) - element.setAttribute("controls", true) + if !element.classList.contains("nnwAnimatedGIF") { + element.setAttribute("controls", true) + } }); }