how do i make my video autoplay homepage youtube dawn theme

3 0 1

I want my video to autoplay on people loading the site i have tried a lot of code and none have worked it is a youtube link and dawn theme

Replies 3 (3)

897 179 196

This is Noah from PageFly - Shopify Page Builder App


To make the video autoplay, you can do the following:

Step 1: Online Stores > Themes > Edit code

Step 2: Choose file theme.liquid
Step 3: Add code above the tag </head>





window.onload = function () {
  setTimeout(function () {
    var video = document.querySelector('video');
    video.autoplay = true;
    video.loop = true;
    video.muted = true;;
  }, 1000);
//1000 corresponds to 1s. If your website takes a long time to load, you can change it to 2000 (2s)




To apply to only 1 video, you need to add an id surrounding that video. Then use this code instead: document.querySelector('#myId video');


Hope my solution will help you resolve the issue.

Best regards,

Noah | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!

PageFly - #1 Page Builder for Shopify merchants.

All features are available from Free plan. Live Chat Support is available 24/7.

Shopify Expert
5401 971 1293

Hi @d1dotzz ,


1. In your Shopify Admin go to online store > themes > actions > edit code
2. Find Layout > theme.liquid and paste this at the bottom of the file:



  document.addEventListener("DOMContentLoaded", function() {
    var video = document.querySelector("video");

    // Check if the video element is found
    if (video) {
      video.autoplay = true;
      video.setAttribute("muted", "true");
    } else {
      console.error("Video element not found.");


Want to modify or develop new app, Hire us.
If helpful then please Like and Accept Solution .
Shopify Apps URL :-
Custom Modifications Into Shopify Theme | Shopify Private App | SEO & Digital Marketing
3 0 1

Do i have to change anything?