User Rating 0.0
Total Usage 0 times
Basic Attributes Video width in pixels
Boolean Attributes
Source Elements
Track Elements (Subtitles / Captions)
Fallback Text
Generated Code
Live Preview

Preview renders your exact markup. Video will only play if the source URLs are valid and accessible.

Is this tool helpful?

Your feedback helps us improve.

About

The HTML5 <video> element replaced Flash-based players but carries configuration complexity that silently breaks playback across browsers. A missing type attribute on a <source> element forces the browser into MIME sniffing, adding 200 - 500ms of latency before first frame. Omitting the playsinline attribute on iOS Safari causes fullscreen hijacking. Forgetting muted alongside autoplay violates autoplay policies in Chrome, Firefox, and Safari, resulting in zero playback with no console error in production. This generator produces spec-compliant markup with correct attribute ordering, proper <source> fallback chains, <track> elements for subtitles and captions (required under WCAG 2.1 Level AA, Success Criterion 1.2.2), and a text fallback for legacy agents. It does not guess. You configure each attribute explicitly, and it emits only what you set. The output follows the WHATWG HTML Living Standard parsing rules. Note: preload is advisory only. Browsers may ignore it on cellular connections to conserve bandwidth.

html5 video video tag generator html video embed video element html code generator web video video attributes

Formulas

The HTML5 video element follows the WHATWG source selection algorithm. Given n <source> children, the browser evaluates each in document order:

canPlayType(typei) { "", "maybe", "probably" }

The first source where the return value "" is selected for loading. If all sources return empty string, a error event fires on the <video> element with error.code = 4 (MEDIA_ERR_SRC_NOT_SUPPORTED).

Autoplay gating logic (Chrome): autoplay is permitted if muted = TRUE MEI 0.5, where MEI is the Media Engagement Index, a per-origin score in range [0, 1] based on prior significant playback events.

Attribute output template: <video [attr1] [attr2] … [attrn]> { <source>×s } { <track>×t } [fallback] </video>

Where s = number of source elements (0 - 5), t = number of track elements (0 - 3), and fallback is plain text displayed by non-supporting user agents.

Reference Data

AttributeTypeDefaultBrowser Notes
srcURLnoneUse <source> for multi-format fallback
controlsBooleanFALSENative UI varies by browser; custom controls override
autoplayBooleanFALSERequires muted in Chrome 66+, Safari 11+
mutedBooleanFALSERequired for autoplay; persists across page loads in some browsers
loopBooleanFALSEUniversal support; fires ended event before restart
playsinlineBooleanFALSECritical for iOS Safari inline playback
preloadEnumautoValues: none, metadata, auto. Advisory only.
posterURLnoneDisplayed before playback; JPEG recommended for size
widthInteger (px)noneCSS override takes precedence; aspect ratio preserved if one set
heightInteger (px)noneSame as width; both optional with CSS sizing
crossoriginEnumnoneValues: anonymous, use-credentials. Required for canvas capture.
disablepictureinpictureBooleanFALSEChrome only; no Firefox/Safari support as of 2024
disableremoteplaybackBooleanFALSEPrevents casting to Chromecast / AirPlay
<source>Element - Order matters: browser picks first playable format
<track>Element - kind: subtitles, captions, descriptions, chapters, metadata
MIME: video/mp4Format - H.264 baseline: universal. H.265/HEVC: Safari, Edge
MIME: video/webmFormat - VP8/VP9: Chrome, Firefox, Edge. No Safari.
MIME: video/oggFormat - Theora: Firefox, Chrome. Declining usage.
MIME: video/mp4; codecs="av01"Format - AV1: Chrome 70+, Firefox 67+. Best compression.
MIME: application/x-mpegURLFormat - HLS: Safari native. Others need hls.js library.

Frequently Asked Questions

Modern browsers block autoplay with audio by default. Chrome requires the muted attribute alongside autoplay, or the user must have a high Media Engagement Index (MEI ≥ 0.5) for that origin. Safari 11+ follows the same policy. Always pair autoplay with muted for reliable behavior. If you need sound, trigger playback programmatically after a user gesture (click or tap).
Place video/mp4 (H.264 Baseline) first for universal coverage including Safari and legacy Edge. Place video/webm (VP9) second for Chrome and Firefox where it offers better compression at equivalent quality. If you support AV1, place video/mp4 with codecs="av01.0.05M.08" third for browsers that support it. The browser picks the first source it can play, so order from most-compatible to best-quality.
You need crossorigin="anonymous" if the video is hosted on a different domain AND you want to capture frames via canvas (drawImage + toDataURL/toBlob), use WebGL textures from it, or access pixel data. Without it, the canvas becomes tainted and data extraction is blocked by CORS. The video server must also send Access-Control-Allow-Origin headers. Use crossorigin="use-credentials" only when cookies or HTTP authentication are required for the video request.
The preload attribute is advisory. Setting preload="none" tells the browser to not download any data until the user clicks play. Setting preload="metadata" downloads only the file header (duration, dimensions, first frame) - typically 100-500 KB. Setting preload="auto" lets the browser buffer as much as it wants. However, mobile browsers on cellular connections often override preload="auto" to preload="metadata" to conserve data. Chrome on Android ignores preload="auto" when Data Saver is enabled.
The track element supports five kind values: subtitles (translations for hearing users), captions (transcription of dialogue and significant sounds for deaf/hard-of-hearing users), descriptions (text descriptions of visual content for blind users), chapters (navigation markers), and metadata (machine-readable data). WCAG 2.1 Level AA (SC 1.2.2) requires captions for all prerecorded video with audio. Level AAA (SC 1.2.5) requires audio descriptions. The generator supports adding up to 3 track elements with configurable kind, label, srclang, and default attributes.
No. The playsinline attribute only affects iOS Safari, which by default opens video in fullscreen on iPhone. Adding playsinline keeps the video inline within the page. On desktop browsers and Android, video always plays inline regardless of this attribute. It has no negative side effects on desktop, so including it universally is safe practice for any video that should not hijack the viewport.