Vimeo player not working with Wordpress DIVI Theme

31 views Asked by At

I am having some trouble integrating this JSfiddle into my website

JSFiddle : https://jsfiddle.net/0dtfpamx/4/

Code :

<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/froogaloop.js"></script>
<iframe id="player1" src="https://player.vimeo.com/video/80312270?api=1&player_id=player1" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen id="video"></iframe>
<div class="show--div-20sec">
  Show me after 20 second of video play
</div>
<div class="buttons">


  <button id="play-button">Play</button>
  <button id="pause-button">Pause</button>

</div>

JQuery

$(function() {
var iframe = $('#player1')[0];
var player = $f(iframe);
var status = $('.status');
var playButton = document.getElementById("play-button");
playButton.addEventListener("click", function() {
  player.api("play");
});

var pauseButton = document.getElementById("pause-button");
pauseButton.addEventListener("click", function() {
  player.api("pause");
});
setTimeout(function () {
player.addEvent('ready', function() {
player.addEvent('playProgress', onPlayProgress);
});
});
function onPlayProgress(data, id) {
var Time = data.seconds; 
    if (Time >= '20') {
    $('.show--div-20sec').show();
    }
}
});

CSS :

.button {
  width: 48px;
  height: 48px;
  cursor: pointer;
}

.defs {
  position: absolute;
  top: -9999px;
  left: -9999px;
}

iframe {
  float: left;
  width: 350px;
  height: 200px;
}

.buttons {
  padding: 1rem;
  background: #f06d06;
  float: left;
}

body {
  padding: 1rem;
}

.show--div-20sec {
  width: 100%;
  background: red;
  height: 80px;
  float: left;
  display: none;
}

I implemented all the required code tried all the other way around to target Vimeo video Iframe, The end target is to show a button once video is played for 20 seconds and failed to do.

Page where i integrated : https://walltomain.com/test/, Its a wordpress divi website.

0

There are 0 answers