How to add a custom video player to your Webflow site

Learn how to add a fully customizable self-hosted video player in Webflow with HTML, CSS and JavaScript while ensuring GDPR compliance.
BeBranded logo
Webflow · 4 min read · Published Feb 17, 2025 · Updated Nov 12, 2026
How to add a custom video player to your Webflow site

Share this article

Summarize this article with AI

Webflow's native Video element is great for embedding content from YouTube and Vimeo, but it lacks flexibility for customization and self-hosted videos. By following this guide, you'll have a fully customized video player that fits your brand and ensures full control over the user experience, built with HTML, CSS and JavaScript in a simple embed.

Why use a custom video player instead of Webflow's native video element?

  • Full control over video behavior: customize controls, autoplay, looping, and fullscreen options.
  • GDPR compliance: unlike YouTube, self-hosted videos do not use tracking cookies, meaning no consent is required.
  • Better branding: no third-party branding or suggested videos after playback.
  • Optimized performance: self-hosted MP4/WebM videos load faster and do not rely on external services. They do consume Webflow bandwidth if hosted on your site, which is why we host them on Cloudinary instead (see our guide on optimizing Webflow bandwidth).

Step 1: convert and host your video

Before adding a video player, make sure your video is in MP4 and WebM formats for maximum compatibility.

Convert your video

Upload your video to Cloudinary

  1. Create a free account on Cloudinary.
  2. Go to Dashboard → Assets and upload your MP4 and WebM files.
  3. Copy the direct video URL from Cloudinary.

Step 2: add the custom video player code

Now that your video is ready, you need to insert it into Webflow using custom HTML, CSS, and JavaScript.

Insert this code in an embed element in Webflow:

<video class="video" width="100%" height="100%">
    <source src="https://res.cloudinary.com/your-account/video.mp4" type="video/mp4">
    <source src="https://res.cloudinary.com/your-account/video.webm" type="video/webm">
</video>

Replace the URLs with the links from your Cloudinary Asset Manager.

Step 3: add custom video player controls

Now, we'll add JavaScript to control video playback, pause, fullscreen, and progress tracking.

Insert this JavaScript in Webflow's custom code section:

<script>
  document.addEventListener("DOMContentLoaded", () => {
    document.querySelectorAll("video").forEach(video => {
      const container = document.createElement("div");
      container.classList.add("video-container");
      video.parentNode.insertBefore(container, video);
      container.appendChild(video);

      const controls = document.createElement("div");
      controls.classList.add("video-controls");

      const playPauseBtn = document.createElement("button");
      playPauseBtn.classList.add("video-button");
      playPauseBtn.innerHTML = `
        <svg id="pauseIcon" width="24" height="24" fill="white">
          <path d="M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2m6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2"></path>
        </svg>
        <svg id="playIcon" width="24" height="24" fill="white" style="display: none;">
          <path d="M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 0 0 0-1.69L9.54 5.98A.998.998 0 0 0 8 6.82"></path>
        </svg>
      `;
      controls.appendChild(playPauseBtn);

      const progressContainer = document.createElement("div");
      progressContainer.classList.add("video-progress-container");

      const progressBar = document.createElement("div");
      progressBar.classList.add("video-progress-bar");
      progressContainer.appendChild(progressBar);
      controls.appendChild(progressContainer);

      const fullscreenBtn = document.createElement("button");
      fullscreenBtn.classList.add("video-button");
      fullscreenBtn.innerHTML = `
        <svg width="24" height="24" fill="white">
          <path d="M4 4h6v2H6v4H4V4m10 0h6v6h-2V6h-4V4m-6 10v4h4v2H4v-6h2m16 0v6h-6v-2h4v-4h2"></path>
        </svg>
      `;
      controls.appendChild(fullscreenBtn);
      container.appendChild(controls);

      playPauseBtn.addEventListener("click", () => {
        if (video.paused) {
          video.play();
          playPauseBtn.querySelector("#playIcon").style.display = "none";
          playPauseBtn.querySelector("#pauseIcon").style.display = "block";
        } else {
          video.pause();
          playPauseBtn.querySelector("#playIcon").style.display = "block";
          playPauseBtn.querySelector("#pauseIcon").style.display = "none";
        }
      });

      fullscreenBtn.addEventListener("click", () => {
        if (video.requestFullscreen) {
          video.requestFullscreen();
        } 
      });

      video.addEventListener("timeupdate", () => {
        const percent = (video.currentTime / video.duration) * 100;
        progressBar.style.width = `${percent}%`;
      });

      progressContainer.addEventListener("click", (e) => {
        const rect = progressContainer.getBoundingClientRect();
        const offsetX = e.clientX - rect.left;
        video.currentTime = (offsetX / rect.width) * video.duration;
      });
    });
  });
</script>

Step 4: style the video player

To make controls visible and responsive, add this CSS in Webflow's Custom Code → Head Section:

<style>
.video-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.video-controls {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  padding: 8px;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}
.video-container:hover .video-controls {
  opacity: 1;
}
.video-button {
  background: none;
  border: none;
  cursor: pointer;
}
.video-progress-container {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  position: relative;
}
.video-progress-bar {
  width: 0%;
  height: 100%;
  background: white;
}
</style>

Alternative: autoplay with Finsweet

If you want your video to autoplay and loop without controls, use Finsweet's Auto Video Attributes (Finsweet Auto Video). This solution removes controls but ensures seamless video playback. And if your videos live in CMS items (portfolio, blog, case studies), our tutorial on adding videos to a Webflow CMS collection covers that workflow in detail.

Conclusion

By implementing a custom video player, you ensure GDPR compliance, improve branding, and gain full control over video behavior. If you want autoplay without controls, consider using Finsweet Auto Video Attributes. Now, your Webflow site can feature fully customized, self-hosted videos without relying on YouTube!

If you would rather have this kind of custom development handled for you, our Webflow agency integrates custom players, animations and embeds as part of every build: feel free to reach out.

FAQ

Questions about this topic.

Another question?

Write to us
Why use a self-hosted video instead of embedding a YouTube video in Webflow?
YouTube videos come with tracking cookies, which require user consent under GDPR regulations. If a visitor does not accept cookies, the YouTube video will not display. Self-hosted videos provide full control over branding, improve loading speeds, and remove third-party ads.
How can I enable autoplay and looping for my Webflow video?
You can use Finsweet's Auto Video Attributes (Finsweet Auto Video) to enable autoplay and looping without user interaction. Add the Finsweet Attributes script with the fs-autovideo attribute to your page: according to Finsweet's documentation, no attribute is needed on the video itself.
Where can I host my self-hosted MP4/WebM videos for Webflow?
Cloudinary is a great option. You can create a free account, upload MP4 and WebM versions, and get a direct video URL to use in your Webflow embed. Hosting the files externally also preserves your Webflow bandwidth allowance.
How can I customize the appearance of my video player in Webflow?
You can customize the video container, play/pause button, progress bar, and fullscreen toggle using CSS. The guide above includes a fully customizable CSS snippet to modify the look of your video player and align it with your brand design.
Does a self-hosted video slow down my Webflow site?
Not if it is properly prepared. Compress the video, provide both MP4 and WebM versions, avoid autoplaying heavy files above the fold, and host the files on a service like Cloudinary so they are served from a CDN. A short, well-compressed video typically loads faster than a YouTube iframe with all its tracking scripts.
Why provide both MP4 and WebM formats?
MP4 (H.264) is supported by virtually every browser and device, while WebM usually offers better compression and smaller file sizes on browsers that support it. By declaring both sources in the video element, the browser automatically picks the best format it can play, which gives you maximum compatibility and optimal performance.

Keep reading

Keep reading, more from the blog.

How to add a video to Webflow without YouTube (complete guide)
Webflow

How to add a video to Webflow without YouTube (complete guide)

Add a self-hosted video to Webflow and your CMS without YouTube: MP4 and WebM formats, hosting, embed code, GDPR compliance and performance.

Read the article
BeBranded
Webflow

How to optimize bandwidth on Webflow and reduce your costs

Images, videos, fonts, scripts: find out what's eating your Webflow bandwidth and how to fix it. Practical guide with checklist and free optimization tool.

Read the article
How to scope custom Webflow code without creating maintenance debt
Webflow

How to scope custom Webflow code without creating maintenance debt

Learn how to scope Webflow custom code, avoid maintenance debt, and define ownership, testing, and documentation before launch.

Read the article

Tools

Webflow

Let’s talk

Tell us what you want to build.

Thirty minutes with the people who will work on your project. You leave with a clear view of the scope, the timeline and the next steps.

What happens next

  1. 1A 30-minute callWe listen to your goals, your constraints and your context.
  2. 2A clear scopeWe map what is worth doing first, and what it takes.
  3. 3A costed proposalYou decide, with no commitment and no sales pitch.