Render the video in the initial HTML
List the sources from widest to narrowest, with the phone version last so it catches everything else. Behind the video, a responsive <picture> shows the opening still for each cut. The video itself gets an empty poster so the matching still shows through until playback starts.
// app/campaign/hero-clip.tsx
import styles from './hero-clip.module.css';
export function HeroClip() {
return (
<div className={styles.clip}>
<picture>
<source srcSet="https://speedyclip.com/media/home/doorway-wide.webp" media="(min-width: 768px)" />
<img src="https://speedyclip.com/media/home/doorway-tall.webp" alt="" />
</picture>
<video controls muted playsInline preload="none"
poster="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" aria-label="Bronze doors opening onto the sea">
<source src="https://speedyclip.com/media/home/doorway-wide.mp4" type="video/mp4" media="(min-width: 768px)" />
<source src="https://speedyclip.com/media/home/doorway-tall.mp4" type="video/mp4" />
</video>
</div>
);
} /* app/campaign/hero-clip.module.css */
.clip { position: relative; aspect-ratio: 674 / 1280; }
.clip :is(picture, img, video) {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
@media (min-width: 768px) {
.clip { aspect-ratio: 1256 / 720; }
} Import <HeroClip /> into your page and swap the example links for your own. The example plays when visitors press play; for a loop that starts by itself, replace controls and preload="none" with autoPlay loop.
Keep the page steady while it loads
The CSS reserves the video’s shape, so nothing below it jumps when it arrives. If the loop plays by itself, give visitors a way to pause it and show the still to anyone who prefers reduced motion. That part needs a small Client Component.
Check which cut each screen gets
Open the page on a phone and on a desktop and play it. Check the framing, the still and that the headline reads over both. See the working example and the Next.js video guide.
Common questions
- Does a background video in Next.js need to be a Client Component?
- No. A Server Component can render the video and its stills straight into the HTML. You only need a Client Component for custom behavior, like your own play button or starting playback from JavaScript.
- Should I put the video files in the public folder?
- Small files can live in public/, but every deploy then carries them and every edit means a new build. Hosting them separately keeps the repository light and lets editors replace the video without a release.
- Why doesn’t autoplay work in my Next.js app?
- React needs the prop written as playsInline, and the video must be muted for autoplay to work on phones. If both are set and an iPhone still won’t play, it may be in Low Power Mode.
Skip the file preparation
Upload one video to Speedy Clip and copy its React embed. It comes with every screen size, its stills and the formats each browser plays best, so there’s nothing to export or commit to the repository.