How to Autoplay and Loop YouTube Videos in WordPress

How to Autoplay and Loop YouTube Videos in WordPress

First Method:

Use below code to play youtube video in loop and most important is please change youtube embed link

<iframe width="560" height="315" src="https://www.youtube.com/embed/AX_bpLLQOWI?autoplay=1&loop=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

Method 2:

This method also make responsive of your video (in mobile and desktop too)


<style type="text/css">
.full-width-youtube-video {position: relative; padding-bottom: 56.25%; height: 0;}
.full-width-youtube-video iframe {position: absolute; top: 0; left: 0; width: 100%; height: 100%;}

@media only screen and (max-width: 600px) {
  .full-width-youtube-video {padding-bottom: 100%;}
}

</style>
<div class="full-width-youtube-video">
	<iframe width="560" height="315" src="https://www.youtube.com/embed/AX_bpLLQOWI?autoplay=1&rel=0&loop=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div>
Secured By miniOrange