Make Background Video Work on iOS and Android.

Webflow's background video component currently works only on desktop devices due to mobile restrictions on auto-playing video. These restrictions have been recently lifted. Inserting the snippet of code below will make background video work as intended on iOS and Android.

By Charlie Jackman
INSTRUCTIONS

Use the background video component as usual. Then copy and paste this snippet before the closing </body> tag. 

Works on iOS 10 and above  |  Android Lollipop (5.0) and above

<!-- START: Mobile Autoplay Video -->
<script>
var mobilevideo = document.getElementsByTagName("video")[0];
mobilevideo.setAttribute("playsinline", "");
mobilevideo.setAttribute("muted", "");
</script>
<!-- END: Mobile Autoplay Video -->

Video Loop "Electric Parallels" via VJ Catmac's Vimeo Channel