From 299b638ac3d818558a90a56655fb7ebc69344971 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 12 Dec 2022 10:00:59 +0800 Subject: [PATCH] Attempt to fix videos not autoplaying on Mobile Safari Fallback onClick to play in case it really still doesn't autoplay --- src/components/status.jsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/status.jsx b/src/components/status.jsx index 23ad9a1b..9e046e41 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -126,12 +126,19 @@ function Media({ media, showOriginal, onClick }) { poster={previewUrl} width={width} height={height} - preload + preload="auto" autoplay muted={isGIF} controls={!isGIF} playsinline loop + onClick={() => { + if (isGIF) { + try { + videoRef.current?.play(); + } catch (e) {} + } + }} > ) : isGIF ? (