diff options
author | David Lu <david.lu@hotmail.com> | 2016-06-21 21:21:40 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-06-21 21:21:40 -0400 |
commit | eb76e61534742b126a35afe12da1deb9c4f8a7d6 (patch) | |
tree | fa91f8b23fb5fc0abf20f885c923ecbf39494327 /webapp/components | |
parent | dd341de0ac091a525744fff69ed79f11700690e4 (diff) | |
download | chat-eb76e61534742b126a35afe12da1deb9c4f8a7d6.tar.gz chat-eb76e61534742b126a35afe12da1deb9c4f8a7d6.tar.bz2 chat-eb76e61534742b126a35afe12da1deb9c4f8a7d6.zip |
stopped youtube videos upon collapsing (#3388)
Diffstat (limited to 'webapp/components')
-rw-r--r-- | webapp/components/post_view/components/post_body_additional_content.jsx | 1 | ||||
-rw-r--r-- | webapp/components/youtube_video.jsx | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/webapp/components/post_view/components/post_body_additional_content.jsx b/webapp/components/post_view/components/post_body_additional_content.jsx index d7cbe5d6c..0ab015ced 100644 --- a/webapp/components/post_view/components/post_body_additional_content.jsx +++ b/webapp/components/post_view/components/post_body_additional_content.jsx @@ -81,6 +81,7 @@ export default class PostBodyAdditionalContent extends React.Component { <YoutubeVideo channelId={this.props.post.channel_id} link={link} + show={this.state.embedVisible} /> ); } diff --git a/webapp/components/youtube_video.jsx b/webapp/components/youtube_video.jsx index 42b193612..a3e8765ae 100644 --- a/webapp/components/youtube_video.jsx +++ b/webapp/components/youtube_video.jsx @@ -46,6 +46,10 @@ export default class YoutubeVideo extends React.Component { return; } + if (props.show === false) { + this.stop(); + } + this.setState({ videoId: match[2], time: this.handleYoutubeTime(link) @@ -221,5 +225,6 @@ export default class YoutubeVideo extends React.Component { YoutubeVideo.propTypes = { channelId: React.PropTypes.string.isRequired, - link: React.PropTypes.string.isRequired + link: React.PropTypes.string.isRequired, + show: React.PropTypes.bool.isRequired }; |