Video: Autoplay Background

Perfect for hero sections, landing pages, and marketing content where you want an engaging video background without audio interruption.

Live Example

Welcome to Our Platform

Experience the future of media delivery

Code Implementation

import { Video } from '@rixl/videosdk-react';

function HeroSection() {
  return (
    <section className="relative h-96 overflow-hidden rounded-xl">
      {/* Background Video */}
      <Video
        id="hero-background-video"
        className="absolute inset-0 w-full h-full object-cover"
        autoPlay={true}
        muted={true}
        loop={true}
        allowPlayPause={false}
        allowFullscreen={false}
        allowPictureInPicture={false}
        theme={"hideUI"}
    />

      {/* Content Overlay */}

      <div
          className={`absolute inset-0 w-full flex
            items-center justify-center bg-black/50`
          }
      >
        <div className="text-center text-white">
          <h1 className="text-4xl font-bold mb-4 text-white">
              Welcome to Our Platform
          </h1>

          <p className="text-xl">
              Experience the future of media delivery
          </p>
        </div>
      </div>
    </section>
  );
}

Key Features

  • Muted Autoplay: Complies with browser autoplay policies
  • Seamless Loop: Video restarts automatically without interruption
  • No Controls: Clean background experience without UI elements
  • Overlay Support: Content can be placed over the video
  • Responsive: Automatically adapts to container size

Configuration Options

PropValuePurpose
autoPlaytrueStart video immediately
mutedtrueRequired for autoplay to work
looptrueRestart video when it ends
allowPlayPausefalseDisable play/pause interaction
allowFullscreenfalseRemove fullscreen option
allowPictureInPicturefalseDisable PiP for background videos
theme"hideUI"Hide Player controls

Best Practices

Browser Autoplay: Always combine autoPlay={true} with muted={true} to ensure videos play automatically across all browsers.

Performance: Use shorter video loops (10-30 seconds) for better performance and faster loading.

Accessibility: Provide a way for users to pause background videos if they find them distracting.