Autoplay youtube video on mobile

charlesr
New Member
11 0 0

In a custom html section, I have placed the code below which shows a youtube video. It autoplays muted on PC and I made an iframewrapper div that chucks all the youtube stuff off-screen so users can't see it - nice and clean. It also includes a playlist consisting of the same video id so that it just loops at the end rather than showing related videos. So far so good. But on mobile, it shows a youtube play button instead of autoplaying. The Prestige theme has an autoplaying youtube embed that works fine on mobile (I have verified this myself, but can't figure out how they did it). Does anyone have any ideas how to make it autoplay on mobile?

 

<style>
.embed-container { 
position: relative;
    padding-bottom: 56.25%; /* 16:9 */  
    padding-top: 25px;
    width: 400%; /* enlarge beyond browser width */
    left: -150%; /* center */
}

 .embed-container iframe, .embed-container object, .embed-container embed {
position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
}

</style>
<div class="iframewrapper">
<div class="embed-container">
<iframe src="https://www.youtube.com/embed/trr932box5k?&amp;loop=1&amp;playlist=trr932box5k&amp;rel=0&amp;controls=0&amp;autoplay=1&amp;mute=1&amp;start=0" frameborder="0" style="position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:auto" allow="autoplay; encrypted-media" allowfullscreen=""></iframe>
</div>
</div>
0 Likes
ldnline
New Member
2 0 0

Hey @charlesr,

I am facing the same issue. Did you ever figure out how to get it to autoplay on mobile?

0 Likes
charlesr
New Member
11 0 0

No, I didn't. Decided it's too slow anyway for SEO.

0 Likes