Using an Embed widget we add the html5 video tag and change our video source to the relevant video (I suggest using Google Cloud as a free hosting service for files).
* If you can decode to WEBM format as well, it will have better compatibility.
<video muted autoplay playsinline loop class="video">
<source src="PLACE_YOUR_VIDEO_URL_HERE" type="video/mp4">
<source src="PLACE_YOUR_VIDEO_URL_HERE" type="video/webm">
Your browser does not support the video tag.
</video>
Now we add the plyr.js library and relevant code:
* this should be added on the page settings under "Before </body> tag"
<script src="https://cdn.plyr.io/3.7.2/plyr.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const controls = [
'mute',
];
const player = Plyr.setup('.video', { controls, muted: true });
});
</script>
Lastly we need to style the video and the plyr.js buttons. We can do some of that with Webflow elements, by giving them the same classes as the plyr.js plugin uses, and then styling the elements in Webflow.
Other elements need some CSS:
* This can go anywhere, preferably in an Embed widget at the top of the canvas
<style>
video {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
-webkit-object-fit: cover;
-moz-object-fit: cover;
-ms-object-fit: cover;
object-fit: cover;
}
.plyr__control svg {
width: 40px;
height: 40px;
margin-right: 10px;
}
.plyr__control span {
display: none;
}
</style>
The videos Kurzgesagt channel creates are so beautifully animated, that I almost forget that I learn so much while watching them!