JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://content.jwplatform.com/libraries/ntEbmj0B.js"></script>
<div class="block">
<div class="videoWrapper">
<iframe id="vimeo_player" src="https://player.vimeo.com/video/181644714?autoplay=1&loop=1&player_id=vimeo_player&title=0&byline=0&portrait=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
<div class="block">
<div class="videoWrapper">
<iframe id="vimeo_player" src="https://player.vimeo.com/video/181644714?autoplay=1&loop=1&player_id=vimeo_player&title=0&byline=0&portrait=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
<div class="block">
<div class="videoWrapper">
<iframe id="vimeo_player" src="https://player.vimeo.com/video/181644714?autoplay=1&loop=1&player_id=vimeo_player&title=0&byline=0&portrait=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
<div class="block">
<div class="videoWrapper">
<iframe id="vimeo_player" src="https://player.vimeo.com/video/181644714?autoplay=1&loop=1&player_id=vimeo_player&title=0&byline=0&portrait=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
<div class="block">
<div class="videoWrapper">
<iframe id="vimeo_player" src="https://player.vimeo.com/video/181644714?autoplay=1&loop=1&player_id=vimeo_player&title=0&byline=0&portrait=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
<div class="block">
<div class="videoWrapper">
<iframe id="vimeo_player" src="https://player.vimeo.com/video/181644714?autoplay=1&loop=1&player_id=vimeo_player&title=0&byline=0&portrait=0" width="640" height="360" frameborder="0"...
CSS
.block {
width: 100%;
padding-top: 200px;
padding-bottom: 200px;
height: 100%;
}
.videoWrapper {}
JavaScript
function onScrollVideo() {
updateVideo();
}
function updateVideo() {
var windowHeight = $(window).height(),
gridTop = 200,
gridBottom = 1000;
$('.jwplayer').each(function() {
var thisTop = $(this).offset().top - $(window).scrollTop(),
playerID = $(this).prop('id');
if (thisTop > gridTop && (thisTop + $(this).height()) < gridBottom) {
jwplayer(playerID).play();
} else {
jwplayer(playerID).pause(true);
}
});
}
window.addEventListener('scroll', onScrollVideo, false);