Autoplay YouTube Videos (but Muted) When Using Embed Code to Share
When using embed code to share a YouTube video, we can set autoplay option as 1 to make it autoplay1. Here is an example (where see &autoplay=1&mute=1 at the end of url):
1
<iframe class="iframe--video" width="560" height="315" src="https://www.youtube.com/embed/8eg__nN-CtQ?si=tLx-GQpPw2pKCOOt&autoplay=1&mute=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
However, note that, right now only muted videos can be autoplayed because of Chrome’s new autoplay policies2:
Chrome’s autoplay policies changed in April of 2018 and I’m here to tell you why and how this affects video playback with sound. Spoiler alert: users are going to love it!
New behaviors
As you may have noticed, web browsers are moving towards stricter autoplay policies in order to improve the user experience, minimize incentives to install ad blockers, and reduce data consumption on expensive and/or constrained networks. These changes are intended to give greater control of playback to users and to benefit publishers with legitimate use cases.
Chrome’s autoplay policies are simple:
- Muted autoplay is always allowed.
 - Autoplay with sound is allowed if:
      
- The user has interacted with the domain (click, tap, etc.).
 - On desktop, the user’s Media Engagement Index threshold has been crossed, meaning the user has previously played video with sound.
 - The user has added the site to their home screen on mobile or installed the PWA on desktop.
 
 - Top frames can delegate autoplay permission to their iframes to allow autoplay with sound.
 
So, we should add &mute=1 in the url at the same time. Then, users need to click the volume button, at the bottom left corner next to play button, to unmute the autoplayed video.
References