From eb76e61534742b126a35afe12da1deb9c4f8a7d6 Mon Sep 17 00:00:00 2001
From: David Lu <david.lu@hotmail.com>
Date: Tue, 21 Jun 2016 21:21:40 -0400
Subject: stopped youtube videos upon collapsing (#3388)

---
 webapp/components/youtube_video.jsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'webapp/components/youtube_video.jsx')

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
 };
-- 
cgit v1.2.3-1-g7c22

