mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-12-18 07:21:56 +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}
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue