diff --git a/app/javascript/flavours/glitch/components/status.jsx b/app/javascript/flavours/glitch/components/status.jsx index 55cdb5c469..30b67efbd8 100644 --- a/app/javascript/flavours/glitch/components/status.jsx +++ b/app/javascript/flavours/glitch/components/status.jsx @@ -602,6 +602,7 @@ class Status extends ImmutablePureComponent { {Component => ( ); mediaIcons.push('video-camera'); diff --git a/app/javascript/flavours/glitch/features/video/index.jsx b/app/javascript/flavours/glitch/features/video/index.jsx index 06604392fe..3363a18f60 100644 --- a/app/javascript/flavours/glitch/features/video/index.jsx +++ b/app/javascript/flavours/glitch/features/video/index.jsx @@ -115,6 +115,7 @@ class Video extends PureComponent { static propTypes = { preview: PropTypes.string, frameRate: PropTypes.string, + aspectRatio: PropTypes.string, src: PropTypes.string.isRequired, alt: PropTypes.string, lang: PropTypes.string, @@ -123,13 +124,11 @@ class Video extends PureComponent { onOpenVideo: PropTypes.func, onCloseVideo: PropTypes.func, detailed: PropTypes.bool, - inline: PropTypes.bool, editable: PropTypes.bool, alwaysVisible: PropTypes.bool, visible: PropTypes.bool, letterbox: PropTypes.bool, fullwidth: PropTypes.bool, - preventPlayback: PropTypes.bool, onToggleVisibility: PropTypes.func, deployPictureInPicture: PropTypes.func, intl: PropTypes.object.isRequired, @@ -399,8 +398,8 @@ class Video extends PureComponent { } } - componentDidUpdate (prevProps) { - if (this.video && this.state.revealed && this.props.preventPlayback && !prevProps.preventPlayback) { + componentDidUpdate (prevProps, prevState) { + if (prevState.revealed && !this.state.revealed && this.video) { this.video.pause(); } } @@ -471,10 +470,6 @@ class Video extends PureComponent { }; toggleReveal = () => { - if (this.state.revealed) { - this.setState({ paused: true }); - } - if (this.props.onToggleVisibility) { this.props.onToggleVisibility(); } else { @@ -543,17 +538,11 @@ class Video extends PureComponent { } render () { - const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, lang, letterbox, fullwidth, detailed, sensitive, editable, blurhash, autoFocus, matchedFilters } = this.props; + const { preview, src, aspectRatio, onOpenVideo, onCloseVideo, intl, alt, lang, letterbox, fullwidth, detailed, sensitive, editable, blurhash, autoFocus, matchedFilters } = this.props; const { currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, revealed } = this.state; const progress = Math.min((currentTime / duration) * 100, 100); const muted = this.state.muted || volume === 0; - const playerStyle = {}; - - if (inline) { - playerStyle.aspectRatio = '16 / 9'; - } - let preload; if (this.props.currentTime || fullscreen || dragging) { @@ -564,90 +553,93 @@ class Video extends PureComponent { preload = 'none'; } + // The outer wrapper is necessary to avoid reflowing the layout when going into full screen return ( -
- - - {(revealed || editable) &&