From f6c8feae6e2e33374245086119aef264cd5fe426 Mon Sep 17 00:00:00 2001 From: Evelyn Eastmond Date: Tue, 21 May 2019 15:08:48 -0400 Subject: [PATCH] Video play/pause test on video step expand/shrink. --- src/components/cards/cards.jsx | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/components/cards/cards.jsx b/src/components/cards/cards.jsx index a44a5079c..dbada35db 100644 --- a/src/components/cards/cards.jsx +++ b/src/components/cards/cards.jsx @@ -98,24 +98,16 @@ class VideoStep extends React.Component { document.body.appendChild(script); const script2 = document.createElement('script'); - script2.onload = () => { - window._wq = window._wq || []; - window._wq.push({ - id: `${this.props.video}`, - onReady: function (video) { - console.log('I got a handle to the video!', video); - } - }); - }; script2.src = 'https://fast.wistia.com/assets/external/E-v1.js'; script2.async = true; document.body.appendChild(script2); } componentDidUpdate () { - // if not expanded, pause video? - if (!this.props.expanded) { - // eslint-disable-next-line no-undef - const video = Wistia.api(`${this.props.video}`); + // eslint-disable-next-line no-undef + const video = Wistia.api(`${this.props.video}`); + if (this.props.expanded) { + video.play(); + } else { video.pause(); } } @@ -355,6 +347,7 @@ const Cards = props => { steps[step].video ? ( ) : (