How to add Youtube video in Divi that loops, auto-play and is muted.

by | Apr 28, 2025 | Divi

Step 1: Double-click or right-click the video you want to add to the page. Choose the ‘copy embed code’

You’ll have something like this:

<iframe width=”966″ height=”435″ src=”https://www.youtube.com/embed/X5WEw2VqY-I” title=”Pubg mobile got lucky moment.” frameborder=”0″ allow=”accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share” referrerpolicy=”strict-origin-when-cross-origin” allowfullscreen></iframe>

Step 2: Go to the desired page where you want the video to be added and set up the width. In the example, I have added it in a full-width setting.

A. Add a section and choose ‘Fullwidth’

B. Choose ‘Fullwidth Code’ module

C. Paste the copied embedded code

It will look like this:

Step 3: To loop, auto-play, and mute the video. First, we need to update the embedded code.

A. Identify the source code(highlighted in yellow).

<iframe width=”966″ height=”435″ src=”https://www.youtube.com/embed/X5WEw2VqY-I” title=”Pubg mobile got lucky moment.” frameborder=”0″ allow=”accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share” referrerpolicy=”strict-origin-when-cross-origin” allowfullscreen></iframe>

B. To add any additional code, always add ‘?’ at the end of the source code(highlighted in yellow)

<iframe width=”966″ height=”435″ src=”https://www.youtube.com/embed/X5WEw2VqY-I?” title=”Pubg mobile got lucky moment.” frameborder=”0″ allow=”accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share” referrerpolicy=”strict-origin-when-cross-origin” allowfullscreen></iframe>

C. To loop the video, we need to make it into a playlist, so first we need to identify the video ID (highlighted in yellow).

<iframe width=”966″ height=”435″ src=”https://www.youtube.com/embed/X5WEw2VqY-I?” title=”Pubg mobile got lucky moment.” frameborder=”0″ allow=”accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share” referrerpolicy=”strict-origin-when-cross-origin” allowfullscreen></iframe>

Add this code playlist=video_ID then add ‘&’ followed by ‘loop=1’ It will look like this:

playlist=X5WEw2VqY-I&loop=1

<iframe width=”966″ height=”435″ src=”https://www.youtube.com/embed/X5WEw2VqY-I?playlist=X5WEw2VqY-I&loop=1” title=”Pubg mobile got lucky moment.” frameborder=”0″ allow=”accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share” referrerpolicy=”strict-origin-when-cross-origin” allowfullscreen></iframe>

D. To autoplay, add this to the existing code:

‘&autoplay=1’

<iframe width=”966″ height=”435″ src=”https://www.youtube.com/embed/X5WEw2VqY-I?playlist=X5WEw2VqY-I&loop=1&autoplay=1” title=”Pubg mobile got lucky moment.” frameborder=”0″ allow=”accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share” referrerpolicy=”strict-origin-when-cross-origin” allowfullscreen></iframe>

E. To mute the video add this:

‘mute=1’’

<iframe width=”966″ height=”435″ src=”https://www.youtube.com/embed/X5WEw2VqY-I?playlist=X5WEw2VqY-I&loop=1&autoplay=1&mute=1” title=”Pubg mobile got lucky moment.” frameborder=”0″ allow=”accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share” referrerpolicy=”strict-origin-when-cross-origin” allowfullscreen></iframe>