Skip to main content
CodivDocs

Video

Embed videos from YouTube, Vimeo, Loom, or self-hosted mp4 with auto-detection.

Usage

<Video> accepts a URL and figures out the right embed format on its own. Pass a YouTube watch URL, a Vimeo link, a Loom share URL, or a self-hosted mp4 — the component picks the right rendering path.

<Video src="https://www.youtube.com/watch?v=dQw4w9WgXcQ" title="Demo video" />

Provider auto-detection

URL patternProviderRender
youtube.com/watch?v=... or youtu.be/...YouTubeiframe with youtube-nocookie.com/embed/{id}
vimeo.com/123456789Vimeoiframe with player.vimeo.com/video/{id}
loom.com/share/...Loomiframe with loom.com/embed/{id}
*.mp4, *.webm, *.oggmp4native <video controls>
Anything else(fall through)iframe with raw URL

You can override auto-detection with the provider prop if your URL doesn't match a recognized pattern (e.g. self-hosted Vimeo on a custom domain).

Examples

<Video src="https://www.youtube.com/watch?v=dQw4w9WgXcQ" title="YouTube embed" />

<Video src="https://vimeo.com/123456789" title="Vimeo embed" />

<Video src="https://loom.com/share/abc123" title="Loom recording" />

<Video src="/videos/intro.mp4" title="Self-hosted mp4" />

Aspect ratio

Default is 16/9. Override for square videos, vertical clips, or unusual ratios:

<Video src="..." aspectRatio="9/16" />
<Video src="..." aspectRatio="4/3" />
<Video src="..." aspectRatio="1/1" />

The aspect ratio is enforced via CSS aspect-ratio so the layout stays stable while the iframe loads — no cumulative layout shift.

Autoplay

Pass autoplay to start the video immediately. Browsers block audio autoplay, so the component automatically mutes the video when autoplay is enabled.

<Video src="https://youtube.com/watch?v=..." autoplay />

Use autoplay sparingly — it surprises readers and can be flagged by accessibility audits. Reserve it for hero/landing pages where the video is the main visual content.

Privacy: youtube-nocookie.com

YouTube embeds use the youtube-nocookie.com domain instead of youtube.com. This is YouTube's "enhanced privacy mode" — no cookies are set until the user starts playback. Helps with GDPR compliance and avoids cookie consent banner conflicts.

Props

PropTypeDefaultDescription
srcstringrequiredVideo URL
titlestringCaption text shown below the video
provider"youtube" | "vimeo" | "loom" | "mp4" | "auto""auto"Override auto-detection
aspectRatiostring"16/9"CSS aspect-ratio value
autoplaybooleanfalseStart playing on mount (muted)

For generic iframe embeds (CodeSandbox, StackBlitz, Figma, etc.), use <Embed> instead.

Last updated April 12, 2026