Fiddle: https://codepen.io/anon/pen/ZyLqPd
Fiddle with YTVideos: https://codepen.io/anon/pen/KqXavy?editors=0100
http://www.seanmccambridge.com/tubular/ https://pupunzi.com/#mb.components/mb.YTPlayer/YTPlayer.html
Are there are libraries out there that easily enable adding a background youtube video to a div?
I've searched over and over and couldn't find anything.
Essentially I want to play a YouTube video as the background for the divs with the images in this screenshot.
$('.canvas .box').YTPlayer({
fitToBackground: true,
videoId: '-JlcxL2ux_A'
});
in your mockup the videos have a normal 16:9 aspect ratio, so that's what i went with instead of the squares you initially had. here are the tweaks:
https://codepen.io/saetia/full/BZwWdx/
video boxes
<div class="ib box">
<div class="responsive"><iframe src="https://www.youtube.com/embed/8nH-49PgKdw?controls=0&showinfo=0&rel=0&autoplay=1&loop=1&playlist=W0LHTWG-UmQ" frameborder="0" allowfullscreen></iframe></div>
</div>
styles
.canvas .box {
display: inline-block;
width: 25%;
pointer-events: none;
}
.canvas .box .responsive {
position: relative;
height: 0;
overflow: hidden;
padding-bottom: 56.25%;
}
.canvas .box iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With