JSFiddle - React, Tailwind, and code Playground
by Sampath_Madhuranga
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="video"></div>
CSS
#video{
position: relative;
background: transparent;
overflow:hidden;
}
.ytplayer{
position: absolute;
top: 0;
z-index: 0;
}
JavaScript
jQuery(function($) {
$('#video').YTPlayer({
fitToBackground: true,
playerVars: {rel: 0},
videoId: '2kZ7BsU2y7U',
pauseOnScroll: false,
playerVars: {
modestbranding: 1,
autoplay: 1,
loop: 1,
controls: 1,
rel: 0,
autohide: 0
}
});
});