1
0
Fork 0

Another attempt at fixing GIF not autoplaying on Mobile Safari

This commit is contained in:
Lim Chee Aun 2022-12-26 01:09:19 +08:00
parent c8ea2e8703
commit 9278645069
2 changed files with 14 additions and 8 deletions

View file

@ -374,6 +374,7 @@
}
.status .media-gif video {
object-fit: cover;
pointer-events: none;
}
.status .media-audio {
border: 0;

View file

@ -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);
}}