🎬Video
Embed self-hosted videos in Webstudio pages.
See MDN: <video>
The Video component embeds an HTML5 <video> element for playing self-hosted video files.
Overview
Use the Video component when you have your own video files to host, rather than embedding from platforms like YouTube or Vimeo. For platform embeds, use the YouTube or Vimeo components instead.
Properties
src
string
URL to the video file
poster
string
Image shown before video plays
autoplay
boolean
Start playing automatically
controls
boolean
Show video controls
loop
boolean
Loop video continuously
muted
boolean
Mute audio by default
playsinline
boolean
Play inline on mobile (vs fullscreen)
preload
string
Preload behavior: none, metadata, auto
width
string
Video width
height
string
Video height
id
string
Unique identifier
class
string
CSS class names
Basic Usage
Video Formats
For best browser compatibility, provide multiple formats:
MP4 (H.264)
video/mp4
Best compatibility
WebM
video/webm
Modern browsers
OGG
video/ogg
Older Firefox
MP4 is recommended as the primary format.
Autoplay Requirements
Browsers restrict autoplay to prevent unwanted media:
Autoplay with Sound
Requires user interaction first
Won't work on page load
Autoplay Muted ✓
Works on page load
Must include
muted: true
Background Video
Create video backgrounds:
Set Video properties:
autoplay: truemuted: trueloop: trueplaysinline: true
Style the Video:
Position: absolute
Object-fit: cover
Width/Height: 100%
Place in a container:
Position: relative
Overflow: hidden
Preload Options
none
Don't preload anything
metadata
Load dimensions and duration only
auto
Browser decides what to preload
Use metadata for most cases to balance performance and user experience.
Responsive Video
Maintain Aspect Ratio
Different Sources for Breakpoints
For different video qualities at different screen sizes, you may need custom HTML using HTML Embed.
Poster Image
The poster attribute shows an image before the video plays:
Use a relevant frame from the video
Optimize the image for quick loading
Match the video's aspect ratio
Performance Tips
Compress videos: Use tools like HandBrake or FFmpeg
Consider file size: Videos should be as small as possible
Use lazy loading: Set preload to "none" for off-screen videos
Provide poster: Show placeholder while video loads
Host on CDN: Fast delivery from edge servers
Accessibility
Provide captions: Add text tracks for hearing impaired
Avoid autoplay audio: Always mute autoplay videos
Include controls: Let users pause/play
Don't autoplay with motion: Can trigger vestibular issues
When to Use
Self-hosted files
Platform content
Background videos
SEO benefits
Full control needed
Free hosting
Privacy requirements
Analytics needed
Custom player UI
Social features
Related Components
YouTube - YouTube video embeds
Vimeo - Vimeo video embeds
Vimeo Background Video - Vimeo for backgrounds
Image - Static images
Last updated
Was this helpful?
