Previously, you could use ‘?autoplay=1’ after the video link in your iframe to display youtube video on your webpage with autoplay. But you may see now the video does not play automatically
This is due to Google’s Autoplay Policy Changes.
‘autoplay=1’ was working before April 2018 to auto-play the embedded Youtube videos. Then, Youtube changed its policy and Youtube Embedded Video Auto-play stopped working. However, You can still auto-play mute videos.
So you have to put this ‘?autoplay=1&mute=1’ after the video link in iframe to autoplay Youtube video.
Please see the example below
<iframe width="560" height="315" src="https://www.youtube.com/embed/2QZf3BVfi6M?autoplay=1&mute=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
The video will be playing in mute mode, however, the user can make it Unmute.