So I have a section at the bottom of the Humanlytics page (incase the read only link sends you to the homepage) where I’ve got a background video that I want to autoplay on mobile…I’ve had a look through the forum and I can’t find a definitive bit of custom code that allows this! There was one that was posted here (Make Webflow's Background Video PLAY on iOS and Android) that doesn’t work for me.
Also, when the video appears on mobile, there is another blurred crop of the video behind it…can anyone advise for either? Thanks so much! I have this custom code in the head section of the project so that the video doesn’t have a weird crop on the screen…is that the problem?
<style> .w-background-video > video { width: 100%; } </style>
I am not sure why, but the video poster is the “blurred crop” behind that is showing.
few things I might suggest to make everything more clear:
Lose the display:grid on the .project grid element. Since your design is mostly vertical, you don’t really need a grid, and it will make it easier debug.
Try giving your background video element a height property, so it will keep the same as the aspect ratio of the video. Since background video’s default is to cover the div, it expands beyond the bounds of that div when the height isn’t adjusted.
Do you mean on mobile? And what display would you recommend, flexbox? I will give it a try
I tried that, gave it a 500px height and still having the same problem…in fact it doesn’t even work when I press the play button on mobile now, it gives me a stretched poster behind it and an unresponsive play button!
Is there a way to change the background video from cover to contain?
Incase anyone is interested, I managed to solve my problem a bit of a different way. I created a repository via prismic.io, uploaded the video, and then embedded it into my site using a HTML embed and this code: