ReferenceMedia
background-video
Decorative background video element with automatic muting and looping
Decorative background video for a source the browser can play natively. By default it’s muted, looped, and autoplaying.
<background-video> renders a <video> inside shadow DOM and fills the box you give the component. Use the opt-out attributes in the API to change its playback defaults.
An HLS URL only works where the browser has native HLS playback. See Add a background video to choose a cross-browser HLS or Mux path and set up layout, poster, and decorative semantics.
Import
Or load it from the CDN:
Examples
Basic Usage
API
Attributes
An explicit muted, loop, or autoplay attribute wins over its opt-out. Opt-outs and passed-through attributes also apply when set or changed after the element is created.
Properties
The element also fires an error event when the inner video does.
Styling
Set an explicit size on the custom element or an author-owned wrapper.