mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-24 08:48:47 +01:00
Another attempt at fixing GIF not autoplaying on Mobile Safari
This commit is contained in:
parent
c8ea2e8703
commit
9278645069
2 changed files with 14 additions and 8 deletions
|
@ -374,6 +374,7 @@
|
|||
}
|
||||
.status .media-gif video {
|
||||
object-fit: cover;
|
||||
pointer-events: none;
|
||||
}
|
||||
.status .media-audio {
|
||||
border: 0;
|
||||
|
|
|
@ -755,14 +755,19 @@ function Media({ media, showOriginal, onClick = () => {} }) {
|
|||
rgbAverageColor && `rgb(${rgbAverageColor.join(',')})`,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
if (showOriginal && isGIF) {
|
||||
try {
|
||||
if (videoRef.current.paused) {
|
||||
videoRef.current.play();
|
||||
} else {
|
||||
videoRef.current.pause();
|
||||
}
|
||||
} catch (e) {}
|
||||
if (isGIF) {
|
||||
// Hmm, the videoRef might conflict here
|
||||
if (showOriginal) {
|
||||
try {
|
||||
if (videoRef.current.paused) {
|
||||
videoRef.current.play();
|
||||
} else {
|
||||
videoRef.current.pause();
|
||||
}
|
||||
} catch (e) {}
|
||||
} else {
|
||||
videoRef.current.pause();
|
||||
}
|
||||
}
|
||||
onClick(e);
|
||||
}}
|
||||
|
|
Loading…
Reference in a new issue