mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-13 22:55:07 +01:00
Pause video playback if toot is collapsed or CWs folded (fixes #146)
This commit is contained in:
parent
a9ed9d3572
commit
d8b2f15b23
@ -430,6 +430,7 @@ export default class Status extends ImmutablePureComponent {
|
||||
sensitive={status.get('sensitive')}
|
||||
letterbox={settings.getIn(['media', 'letterbox'])}
|
||||
fullwidth={settings.getIn(['media', 'fullwidth'])}
|
||||
preventPlayback={isCollapsed || !isExpanded}
|
||||
onOpenVideo={this.handleOpenVideo}
|
||||
/>)}
|
||||
</Bundle>
|
||||
|
@ -101,6 +101,7 @@ export default class Video extends React.PureComponent {
|
||||
fullwidth: PropTypes.bool,
|
||||
detailed: PropTypes.bool,
|
||||
inline: PropTypes.bool,
|
||||
preventPlayback: PropTypes.bool,
|
||||
intl: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
@ -215,6 +216,12 @@ export default class Video extends React.PureComponent {
|
||||
document.removeEventListener('MSFullscreenChange', this.handleFullscreenChange, true);
|
||||
}
|
||||
|
||||
componentDidUpdate (prevProps) {
|
||||
if (this.video && this.state.revealed && this.props.preventPlayback && !prevProps.preventPlayback) {
|
||||
this.video.pause();
|
||||
}
|
||||
}
|
||||
|
||||
handleFullscreenChange = () => {
|
||||
this.setState({ fullscreen: isFullscreen() });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user