From 2815ac41557864932d163d52f67ff4aee7b834fb Mon Sep 17 00:00:00 2001 From: James Adney Date: Sun, 27 Nov 2022 11:46:23 -0800 Subject: [PATCH] [Glitch] fix gif autoplay on iOS Port c0dcf15d1ec357cedd89025a1b210bdc21422b59 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/components/media_gallery.js | 4 ++-- .../glitch/features/account_gallery/components/media_item.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/javascript/flavours/glitch/components/media_gallery.js b/app/javascript/flavours/glitch/components/media_gallery.js index 5414b4858..ac0d05926 100644 --- a/app/javascript/flavours/glitch/components/media_gallery.js +++ b/app/javascript/flavours/glitch/components/media_gallery.js @@ -4,7 +4,6 @@ import PropTypes from 'prop-types'; import { is } from 'immutable'; import IconButton from './icon_button'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { isIOS } from '../is_mobile'; import classNames from 'classnames'; import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; import { debounce } from 'lodash'; @@ -202,7 +201,7 @@ class Item extends React.PureComponent { ); } else if (attachment.get('type') === 'gifv') { - const autoPlay = !isIOS() && this.getAutoPlay(); + const autoPlay = this.getAutoPlay(); thumbnail = (
@@ -216,6 +215,7 @@ class Item extends React.PureComponent { onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} autoPlay={autoPlay} + playsInline loop muted /> diff --git a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js index a16ee4806..f7a7fd467 100644 --- a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js +++ b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js @@ -2,7 +2,6 @@ import Blurhash from 'flavours/glitch/components/blurhash'; import classNames from 'classnames'; import Icon from 'flavours/glitch/components/icon'; import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; -import { isIOS } from 'flavours/glitch/is_mobile'; import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; @@ -109,7 +108,8 @@ export default class MediaItem extends ImmutablePureComponent { src={attachment.get('url')} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} - autoPlay={!isIOS() && autoPlayGif} + autoPlay={autoPlayGif} + playsInline loop muted />