April 4, 2025

How to Set a Video to Autoplay on Mobile in Shopify

Arrow pointing left
back to blog

about

Learn how to set a video to auto play for mobile site visitors on your Shopify store to create a more custom experience for those shoppers.

the author

Angela Sokolovska
Ecommerce expert

share this post

Adding autoplay videos to your Shopify store can create an immersive, dynamic experience that captures attention right away. But when it comes to how to autoplay a video on mobile in Shopify, things get a little tricky.

Mobile browsers are stricter than desktop browsers. Most modern mobile browsers disable autoplay with sound to protect users from unexpected noise and data usage. But that doesn’t mean you can’t autoplay a muted video on mobile—it just requires the right setup.

In this guide, we’ll show you two practical ways to autoplay videos on mobile in Shopify:

Create unique mobile experiences with Shogun

Use Shogun’s drag-and-drop Page Builder to add high-converting, autoplay videos to your Shopify pages—optimized for every device.

Start Adding Videos with Shogun

Setting up Autoplay Videos on Mobile Devices by Editing Theme Code

If you’re comfortable working with HTML and Shopify’s Liquid templating language, editing your theme files gives you full control over video placement and autoplay behavior. While Shopify doesn’t offer a built-in autoplay toggle, the platform’s flexible theme architecture allows you to embed HTML5 video elements directly into your storefront.

That said, mobile autoplay isn’t as straightforward as it is on desktop. Most modern mobile browsers—especially Safari on iOS and Chrome on Android—block autoplaying videos with sound to protect users from unexpected media playback and unnecessary data usage.

To get around this, your embedded video must meet specific conditions:

  • It must be muted
  • It should include the playsinline attribute (especially for iOS)
  • It should use a mobile-friendly format like .mp4
  • It’s recommended to keep it short and lightweight to reduce load times

Let’s say you want to autoplay a muted background video in your homepage hero section. You’ll need to open your theme files and embed a customized <video> element in the appropriate Liquid file—usually something like sections/hero.liquid or templates/index.liquid.

This method is ideal if you:

  • Need total design and playback control
  • Want to autoplay background videos without using third-party apps
  • Are customizing a theme deeply for branded experiences

It’s also worth noting that this approach gives you the flexibility to apply autoplay settings conditionally—such as only showing a video when the visitor is on mobile using Shopify’s Liquid conditionals and CSS media queries.

We’ll walk through the steps next to make sure your video works reliably across mobile devices without causing performance issues or user frustration.

  • Before the video can be referenced in your theme, upload the video file to your Shopify store under Content > Files. Once uploaded, you’ll get a direct file URL or filename that you can use to embed it in the theme code.
  • After saving your changes, test the implementation using an actual mobile device or a responsive preview tool in your browser (like Chrome DevTools). Make sure the video autoplays, loops as expected, and does not interfere with load time or user interaction.
  • Navigate to Online Store > Themes in your Shopify admin. Click Actions > Edit code on your live theme to open the code editor.
  • Decide where you want the video to appear—such as in a hero section, product page, or custom landing page. You’ll typically need to open a section file (like hero.liquid or slideshow.liquid) or a template file (like index.liquid) depending on where the video belongs and add the following code snippet along with your mp4 video URL:
<video autoplay muted playsinline loop style="width: 100%; height: auto;">
  <source src="YOUR_VIDEO_URL_HERE.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

<script>
  document.addEventListener('DOMContentLoaded', function () {
    const video = document.querySelector('video');
    if (video) {
      video.muted = true;
      video.play().catch(function(e) {
        console.warn('Autoplay blocked:', e);
      });
    }
  });
</script>
code for mobile video autoplay in shopify liquid file
Create unique mobile experiences with Shogun

Use Shogun’s drag-and-drop Page Builder to add high-converting, autoplay videos to your Shopify pages—optimized for every device.

Start Adding Videos with Shogun

Setting up Autoplay Videos on Mobile Devices Using Shogun

If you’ve ever tried to figure out how to autoplay a video on mobile in Shopify, you’ve probably run into code limitations, inconsistent browser behavior, or just plain frustration. That’s where Shogun comes in.

For ecommerce teams that want a faster, more flexible solution—without editing Liquid files or worrying about compatibility—Shogun offers a visual, drag-and-drop interface to set up mobile autoplay video in just a few clicks.

Why Shogun Is Ideal for Mobile Video Autoplay

Unlike manual coding, Shogun Page Builder removes the guesswork. You don’t need to write HTML or worry about browser quirks. Instead, you simply drop in a video element, adjust a few settings, and instantly preview how it performs on mobile vs. desktop.

More importantly, Shogun ensures your autoplay settings follow mobile browser rules: muted playback, inline video behavior, and file compatibility. That means you get the same autoplay functionality—without digging through your Shopify theme code.

Step-by-Step: How to Autoplay a Video on Mobile in Shopify Using Shogun

  • From your Shopify admin, navigate to Apps > Shogun Page Builder. Choose the page you want to edit (or create a new one).
  • Use the Visual Editor to drag and drop a Video Element onto your page. This is where you’ll embed the video you want to autoplay.
Embedding Shogun's video element
  • Shogun supports direct video file links (like MP4 files hosted on Shopify or your CDN). These are ideal for autoplay because they give you full control. YouTube and Vimeo may not autoplay reliably on mobile due to platform restrictions.
  • In the right-hand settings panel, toggle on the following: Autoplay, Muted (required for mobile autoplay) and Loop.
Toggle video settings in Shogun
  • These settings tell mobile browsers it’s okay to autoplay the video—without launching it fullscreen or requiring user interaction.
  • Want one video for desktop and a different version for mobile? With Shogun, it’s easy:
    • Duplicate the Video Element
    • Use Visibility Controls to show one version only on mobile and the other on desktop
    • Adjust sizing and layout per device to ensure a clean user experience
Adjusting video visibility settings for different screen sizes in Shogun
  • Test your page using Shogun’s built-in device previews. Once everything looks great, hit Publish—your mobile autoplay video is live.

Built-In Mobile Optimization with Shogun

Learning how to autoplay a video on mobile in Shopify is a major win for improving user engagement—but Shogun doesn’t stop there. Beyond autoplay functionality, it also gives you the mobile design control you need to create pages that look and perform great on smaller screens.

Mobile users behave differently than desktop shoppers. They scroll faster, have shorter attention spans, and expect instant page loads. That’s why Shogun includes built-in mobile optimization tools that help you fine-tune every aspect of your page—from visibility to performance.

Here’s what you can do:

Device-Specific Visibility: Shogun’s visibility settings let you choose which content appears on desktop, tablet, and mobile—without duplicating your entire page.

For example:

  • Want to show an autoplay video banner on desktop but use a static image for mobile? Easy.
  • Prefer to hide a lengthy text section on mobile to streamline the experience? Just uncheck mobile visibility.

This level of control ensures your mobile users only see what’s relevant to them, helping pages load faster and feel more intuitive.

Mobile-First Spacing and Layout: One of the most common design issues is spacing that looks great on desktop—but breaks or feels cramped on mobile.

Shogun solves this with device-specific styling:

  • Adjust padding and margins per device
  • Resize images and video blocks so they scale naturally
  • Reposition or stack elements vertically for better flow

You’re no longer stuck with a one-size-fits-all layout. Instead, you can design your mobile site with just as much care as your desktop version—without writing any custom CSS.

Lazy Loading for Faster Performance: Adding autoplay videos to a Shopify store is exciting—but not if it slows down your page.

That’s why Shogun uses lazy loading by default on images and videos. This means the content only loads when the user scrolls into view—reducing the initial page load time and improving Core Web Vitals.

If you’re wondering how to autoplay a video on mobile in Shopify without hurting speed, lazy loading is your answer. It ensures your content is performant and mobile-friendly—even with rich media like video.

Why Mobile Autoplay Matters More Than Ever

Mobile shoppers are more impatient and more distracted. You have only seconds to catch their attention—and autoplay video can do that faster than static imagery or text.

Stats to keep in mind:

  • 60% of shoppers say video gives them a better sense of a product.
  • Mobile commerce is projected to make up 59% of all retail ecommerce sales by 2025, reaching an estimated $4.01 trillion globally.
  • Video landing pages can increase conversions by up to 86%.

But none of that matters if your video doesn’t load, won’t autoplay, or clutters your mobile layout.

By combining proper video setup with Shogun’s visual tools, you can deliver impactful, high-converting video experiences that work across all devices.

Create unique mobile experiences with Shogun

Use Shogun’s drag-and-drop Page Builder to add high-converting, autoplay videos to your Shopify pages—optimized for every device.

Start Adding Videos with Shogun

You might also enjoy

Get started for free

Get hands on with everything you need to grow your business with a comprehensive suite of tools.
Start now
Arrow pointing up and to the right Arrow pointing up and to the right