Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML <video> tags


May 05, 2021 HTML Reference Manual


Table of contents


HTML and video. Tags

If the tab can embed video content into an HTML document, refer to the following example:

Play video:

<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the Video label.
</video>

Try it out . . .

Browser support

HTML <video> tags HTML <video> tags HTML <video> tags HTML <video> tags HTML <video> tags

IE 9 Plus, Firefox, Opera, Chrome, and Safari all support the hashtag.

Note: IE 8 or earlier versions of IE browsers do not support the label.


Label definition and instructions for use

Tags define videos, such as movie clips or other video streams.

Currently, the element supports three video formats: MP4, WebM, and Ogg.

Browser MP4 WebM Ogg
Internet Explorer YES NO NO
Chrome YES YES YES
Firefox YES
Start with Firefox 21
The Linux system starts with Firefox 30
YES YES
Safari YES NO NO
Opera YES
Start with Opera 25
YES YES
  • MP4 - MPEG 4 files use the H264 video codec and the AAC audio codec
  • WebM - WebM files use VP8 video codec and Vorbis audio codec
  • The Ogg-Ogg file uses the Theora video codec and the Vorbis audio codec

The type of MIME for the audio format

Format MIME-type
MP4 video/mp4
WebM video/webm
Ogg video/ogg


The difference between HTML 4.01 and HTML5

The label is the new label for HTML5.


Tips and comments

Tip: You can place text content between the label, so that browsers that do not support the element can display information about the label.


Optional properties

New : The new property in HTML5.

Attributes value describe
autoplay New autoplay If this property occurs, the video is played immediately after ready.
controls New controls If this property occurs, the user displays the control, such as playing buttons.
height New pixels Set the height of the video player.
loop New loop If this property occurs, start playing again when the media file completes the playback.
muted New muted If this property occurs, the audio output of the video is muted.
poster New URL Specifies the image displayed when the video is downloading until the user tap the play button.
preload New auto
metadata
none
If this property occurs, the video is loaded when the page is loaded and ready to play.If you use "AutoPlay", ignore this property.
src New URL The URL of the video to be played.
width New pixels Set the width of the video player.

Global properties

The label supports the global properties of HTML.


The event property

The tag supports the event properties of HTML.


Related articles

HTML DOM Reference Manual: HTML DOM Video Object