From 9ad956049b56ac96def1e019a77e31105ccb3cb9 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 11 Dec 2022 11:20:24 +0800 Subject: [PATCH] Another attempt to fix GIFV not auto-playing on Mobile Safari --- src/components/status.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/status.jsx b/src/components/status.jsx index 98ac7486..11b4d758 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -95,7 +95,14 @@ function Media({ media, showOriginal, onClick }) { style={{ backgroundColor: `rgb(${rgbAverageColor.join(',')})`, }} - onClick={onClick} + onClick={(e) => { + if (isGIF) { + try { + videoRef.current?.pause(); + } catch (e) {} + } + onClick(e); + }} onMouseEnter={() => { if (isGIF) { try {