diff --git a/src/components/cards/card.css b/src/components/cards/card.css
index a0a8b88d5..5a160c455 100644
--- a/src/components/cards/card.css
+++ b/src/components/cards/card.css
@@ -275,14 +275,6 @@
margin-right: 0.5rem;
}
-.video-cover {
- width: 100%;
- height: 100%;
- position: absolute;
- top: 0;
- left: 0;
-}
-
.steps-list {
display: flex;
flex-direction: row;
diff --git a/src/components/cards/cards.jsx b/src/components/cards/cards.jsx
index 83e40bf49..9424d108d 100644
--- a/src/components/cards/cards.jsx
+++ b/src/components/cards/cards.jsx
@@ -85,32 +85,50 @@ const CardHeader = ({onCloseCards, onShrinkExpandCards, onShowAll, totalSteps, s
);
-// Video step needs to know if the card is being dragged to cover the video
-// so that the mouseup is not swallowed by the iframe.
-const VideoStep = ({video, dragging}) => (
-
- {dragging ? (
-
- ) : null}
-
-
-
-);
+class VideoStep extends React.Component {
+ componentDidMount () {
+ const script = document.createElement('script');
+ script.src = `https://fast.wistia.com/embed/medias/${this.props.video}.jsonp`;
+ script.async = true;
+ script.setAttribute('id', 'wistia-video-content');
+ document.body.appendChild(script);
+
+ const script2 = document.createElement('script');
+ script2.src = 'https://fast.wistia.com/assets/external/E-v1.js';
+ script2.async = true;
+ script2.setAttribute('id', 'wistia-video-api');
+ document.body.appendChild(script2);
+ }
+ componentDidUpdate () {
+ const video = window.Wistia.api(`${this.props.video}`);
+ if (!this.props.expanded) {
+ video.pause();
+ }
+ }
+ componentWillUnmount () {
+ const script = document.getElementById('wistia-video-content');
+ script.parentNode.removeChild(script);
+
+ const script2 = document.getElementById('wistia-video-api');
+ script2.parentNode.removeChild(script2);
+ }
+ render () {
+ return (
+
+ );
+ }
+}
VideoStep.propTypes = {
- dragging: PropTypes.bool.isRequired,
+ expanded: PropTypes.bool.isRequired,
video: PropTypes.string.isRequired
};
@@ -298,6 +316,7 @@ const Cards = props => {
>
{
steps[step].video ? (
) : (