about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorJames Adney <jfadney@gmail.com>2022-11-27 11:46:23 -0800
committerGitHub <noreply@github.com>2022-11-27 20:46:23 +0100
commitc0dcf15d1ec357cedd89025a1b210bdc21422b59 (patch)
tree53859e98921f7f93f9b4078411b4b034a1ff1fe1 /app/javascript
parente617ee7fd9a3dcbb0936f29c99381e1fef92455b (diff)
fix gif autoplay on iOS (#21422)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/components/media_gallery.js4
-rw-r--r--app/javascript/mastodon/features/account_gallery/components/media_item.js4
2 files changed, 4 insertions, 4 deletions
diff --git a/app/javascript/mastodon/components/media_gallery.js b/app/javascript/mastodon/components/media_gallery.js
index 2e7ce2e60..bf7982cea 100644
--- a/app/javascript/mastodon/components/media_gallery.js
+++ b/app/javascript/mastodon/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, cropImages, displayMedia, useBlurhash } from '../initial_state';
 import { debounce } from 'lodash';
@@ -181,7 +180,7 @@ class Item extends React.PureComponent {
         </a>
       );
     } else if (attachment.get('type') === 'gifv') {
-      const autoPlay = !isIOS() && this.getAutoPlay();
+      const autoPlay = this.getAutoPlay();
 
       thumbnail = (
         <div className={classNames('media-gallery__gifv', { autoplay: autoPlay })}>
@@ -195,6 +194,7 @@ class Item extends React.PureComponent {
             onMouseEnter={this.handleMouseEnter}
             onMouseLeave={this.handleMouseLeave}
             autoPlay={autoPlay}
+            playsInline
             loop
             muted
           />
diff --git a/app/javascript/mastodon/features/account_gallery/components/media_item.js b/app/javascript/mastodon/features/account_gallery/components/media_item.js
index 3190caeb4..f16fe07f1 100644
--- a/app/javascript/mastodon/features/account_gallery/components/media_item.js
+++ b/app/javascript/mastodon/features/account_gallery/components/media_item.js
@@ -2,7 +2,6 @@ import Blurhash from 'mastodon/components/blurhash';
 import classNames from 'classnames';
 import Icon from 'mastodon/components/icon';
 import { autoPlayGif, displayMedia, useBlurhash } from 'mastodon/initial_state';
-import { isIOS } from 'mastodon/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
           />