We've been trying to make embed video responsive on our website and managed to do it with code below. Unfortunately it doesn't autoplay anymore and I honestly can't find any solution to this.
CSS
#embed {
height: auto;
text-align: center;
width: 100%;
max-width: 1000px;
margin: 0 auto;
}
.homevideo {
position: relative;
padding-bottom: 56.25%;
height: 0;
}
.homevideo iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
HTML
<section id="embed">
<div class="homevideo">
<p align="center"><iframe width="1000px" height="520px" src="https://www.youtube.com/embed/mUFAaEWb2_E?autoplay=1&mute=0&loop=1&vq=hd1080"name="youtube embed" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></p>
</div>
</section>
Before, we just had an iframe code which looked like it:
<p align="center"><iframe width="1000px" height="520px" src="https://www.youtube.com/embed/mUFAaEWb2_E?autoplay=1&mute=0&loop=1&vq=hd1080"name="youtube embed" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
and it worked well, was playing right after you entered our website on autoplay with sound, so we know it's possible. Sadly it wasn't responsive on mobile devices and was messing up our layout so we were looking for solutions to make it look good, but ended up with no autoplay.