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
Topic summary
A user seeks to enable video autoplay on their homepage using the Dawn theme with a YouTube link embed, but previous attempts with various code solutions have failed.
Proposed Solutions:
Two responders provided similar approaches:
- Access theme code: Navigate to Online Stores > Themes > Edit code
- Modify theme.liquid file: Locate the theme.liquid file under Layout
- Insert JavaScript: Add autoplay code above the
</head>tag or at the bottom of the file - Target specific video: Use
document.querySelector('#my-video-id')and add an ID attribute to the video element if applying to only one video
Current Status:
The original poster asked a follow-up question about whether additional changes are needed, but the text appears corrupted/reversed, making the exact question unclear. The discussion remains open with the user seeking clarification on implementation.
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
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
Hi @d1dotzz ,
- In your Shopify Admin go to online store > themes > actions > edit code
- Find Layout > theme.liquid and paste this at the bottom of the file:
Do i have to change anything?