asp.net.ph

Skip Navigation Links

VIDEO Element | VIDEO Object

Language References


Embeds video content in an HTML document.HTML 5

HTML Syntax

Remarks

The VIDEO element is used to embed video content in an HTML document, without requiring any third-party plug-in or involve complex scripting.

In its simplest form, the src attribute is required, which specifies the location of the video file to embed.

Alternatively, authors can use the SOURCE element, as it allows for multiple alternative options.

A <source> tag specifies a video file, which can be any of three supported video formats in HTML: MP4, WebM, and OGG.

The <source> tags are defined as child elements of the <video>...</video> tag.

<video ...>
   <source src="clip.mp4" ...>
   <source src="clip.ogg" ...>
</video>

The browser plays the first source it supports.

In addition, a VIDEO element can contain one or more TRACK elements when the video content includes tracks for captions, chapters, descriptions, metadata or subtitles.

Likewise, <track> tags are defined as child elements of the <video>...</video> tag.

<video ...>
   <source src="clip.mp4" ...>
   <source src="clip.ogg" ...>
   <track src="subs_en.vtt" kind="subtitles" ...>
   <track src="subs_no.vtt" kind="subtitles" ...>
</video>

A download link or some “fallback” text can be defined within the <video>...</video> tags, to provide alternate content in cases where the browser does not support the VIDEO element or the video content, or somehow failed to download the video source file.

<video src="clip.mp4" ...>
   Sorry, your browser does not support video playback.
   http://somewhere.com/media/clip.mp4
</video>

NOTE: Both start and end tags are required.

Attributes

The <video> element supports the following attributes, in addition to global attributes common to all HTML media elements.

AttributeValueDescription
autoplayautoplaySpecifies whether the video will automatically start playing as soon as it can do so.
controlscontrolsSpecifies whether to display video controls that allow users to play/stop video, adjust/mute volume, etc.
heightpixelsSets the height of the video’s display area.
looploopSpecifies whether the video will automatically start over again, upon reaching the end.
mutedmutedSpecifies whether the audio ouput is silenced.
posterURLSpecifies an image to be shown while the video is loading, or until the user hits the play button.
preloadauto | metadata | noneSpecifies if and how the author thinks the video should be loaded when the page loads. Setting autoplay overrides this attribute.
srcURLRequired. Specifies the location of the video file to embed.
widthpixelsSets the width of the video’s display area.

Example

<video autoplay controls width=640 height=360>
   <source src="praise.mp4" type="video/mp4">
   Sorry, your browser does not support the video element.
</video>

which would render on a Web page as follows:

See Also

AUDIO   EMBED   OBJECT



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note