Start autoplaying gifs only on hover or tap

This commit is contained in:
arne 2025-11-21 07:44:15 +01:00
commit 33ebd5eb2a

View file

@ -358,9 +358,12 @@
"video" [:video {:controls true}
[:source {:type (str "video/" ext) :src remote-url}]
[:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]]
"gifv" [:video {:loop true :autoplay true :muted true}
"gifv" (let [autoplay (r/atom false)
toggle-autoplay #(swap! autoplay not)]
(fn []
[:video {:loop true :autoplay @autoplay :muted true :on-pointer-enter toggle-autoplay}
[:source {:type (str "video/" ext) :src remote-url}]
[:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]]
[:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]]))
[:div [:strong "Unsupported attachment"]
[debug attachment]])))