Attempt to fix videos not autoplaying on Mobile Safari

Fallback onClick to play in case it really still doesn't autoplay
This commit is contained in:
Lim Chee Aun 2022-12-12 10:00:59 +08:00
parent 0289d20d8b
commit 299b638ac3

View file

@ -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) {}
}
}}
></video>
) : isGIF ? (
<video
@ -140,7 +147,7 @@ function Media({ media, showOriginal, onClick }) {
poster={previewUrl}
width={width}
height={height}
preload
preload="auto"
// controls
playsinline
loop