Video

Video

Video embed with auto-detection for YouTube, Vimeo, and HTML5 video sources

Damarukam

Click to play

Installation

npx @ravikumarsurya/mdx-ui add video

Usage

Pass any video URL — the component auto-detects the source type.

<Video
  src="https://www.youtube.com/watch?v=Tn6-PIqc4UM"
  caption="React in 100 seconds"
/>

Examples

YouTube

<Video
  src="https://www.youtube.com/watch?v=Tn6-PIqc4UM"
  title="React in 100 seconds"
  caption="A quick overview of React"
/>

Supports all YouTube URL formats:

  • https://www.youtube.com/watch?v=VIDEO_ID
  • https://youtu.be/VIDEO_ID
  • https://www.youtube.com/embed/VIDEO_ID

Vimeo

<Video src="https://vimeo.com/123456789" caption="Demo walkthrough" />

HTML5 video (self-hosted)

<Video src="/demos/feature-demo.mp4" caption="Feature demo" />

Supports .mp4, .webm, .ogg. Renders a native <video controls> element.

Autoplay (silent loop, common for demos)

<Video src="/demos/animation.mp4" autoPlay loop muted />

Note: browsers require muted for autoplay to work. When autoPlay is set, muted defaults to true automatically.

How source detection works

URL patternRenders
youtube.com/watch?v=...YouTube iframe embed
youtu.be/...YouTube iframe embed
vimeo.com/123...Vimeo iframe embed
.mp4, .webm, .oggHTML5 <video>

Props

PropTypeDefaultDescription
srcstringVideo URL or file path (required)
titlestringTitle for iframes (accessibility)
captionstringCaption below the video
autoPlaybooleanfalseAutoplay (HTML5 and YouTube/Vimeo)
loopbooleanfalseLoop (HTML5 only)
mutedbooleantrue when autoPlayMute audio (HTML5 only)
classNamestringExtra classes on the outer <figure>