mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-12-18 09:41:57 +03:00
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:
parent
0289d20d8b
commit
299b638ac3
1 changed files with 9 additions and 2 deletions
|
@ -126,12 +126,19 @@ function Media({ media, showOriginal, onClick }) {
|
||||||
poster={previewUrl}
|
poster={previewUrl}
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
preload
|
preload="auto"
|
||||||
autoplay
|
autoplay
|
||||||
muted={isGIF}
|
muted={isGIF}
|
||||||
controls={!isGIF}
|
controls={!isGIF}
|
||||||
playsinline
|
playsinline
|
||||||
loop
|
loop
|
||||||
|
onClick={() => {
|
||||||
|
if (isGIF) {
|
||||||
|
try {
|
||||||
|
videoRef.current?.play();
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
}}
|
||||||
></video>
|
></video>
|
||||||
) : isGIF ? (
|
) : isGIF ? (
|
||||||
<video
|
<video
|
||||||
|
@ -140,7 +147,7 @@ function Media({ media, showOriginal, onClick }) {
|
||||||
poster={previewUrl}
|
poster={previewUrl}
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
preload
|
preload="auto"
|
||||||
// controls
|
// controls
|
||||||
playsinline
|
playsinline
|
||||||
loop
|
loop
|
||||||
|
|
Loading…
Reference in a new issue