I’m adding a video to my page, I want it to behave as a GIF, meaning, no sound, no UI to control it and for it to autoplay as soon as the page is loaded.
So far I’ve managed all but to make it autoplay as soon as the page is loaded.
To make your video autoplay as soon as the page is loaded in your Shopify store, you’ll need to ensure a few things in your video settings and potentially add a small piece of JavaScript to your theme.
Steps to Autoplay the Video1. Video Settings: Ensure your video is embedded correctly and has the following attribute
.autoplay.muted.loop(if you want it to repeat)
For example:
2. JavaScript to Autoplay: If the video doesn’t autoplay despite having the correct attributes, you can add JavaScript to force it. Here’s how:
Online Store > Themes > Edit Code
Open the theme.liquid file or the specific template file where your video is located.
At the bottom of the file (before the closing tag), add the following Javascript:
Check Browser Autoplay Policies: Note that some browsers have strict autoplay policies that prevent videos from autoplaying unless they’re muted. Since you’ve already set the video to mute, this should allow it to autoplay in most cases.
Let me know if you need any further assistance!
If I managed to help you then, don’t forget to Like it and Mark it as Solution!