video tag
The video tag, which, when implemented in the code, is written like this - <video>, is an HTML tag that belongs to audio/video tags. Audio and Video HTML tags are used to insert audio and video content. The multimedia content is played thorugh the default player of a user's browser.
<video> specifies video, such as a movie clip or other video streams. Currently, there are 3 supported video formats for the <video> element: MP4, WebM, and Ogg. This tag is supported in the current version of HTML, which is HTML5.
Browser support
Here you can see whether <video> is supported by a certain browser, and, if yes, starting from which version it is supported.
Chrome | Firefox | Edge | Opera | Safari |
---|---|---|---|---|
Supported since Chrome v4 | Supported since Firefox v3.5 | Supported since Edge v9 | Supported since Opera v10.5 | Supported since Safari v4 |
Attributes and values
An attribute is a piece of additional information about a tag. While tags denote the type of objects they mark or create, attributes set the parameters of these objects. These parameters can include anything from the types of possible interactions to its visual style to its actual contents.
Values indicate how a certain attribute is actually implemented, if there is a number of ways it can happen.
What attributes are actually allowed in a certain tag depends on the tag itself. Much like possible attributes depend on a tag, possible values depend on an attribute.
The <video> tag supports the following attributes (with their respective values):
Attribute | Value | Description |
---|---|---|
autoplay | autoplay | Specifies that the video will start playing as soon as it is ready |
controls | controls | Specifies that video controls should be displayed (such as a play/pause button etc). |
height | pixels | Sets the height of the video player |
loop | loop | Specifies that the video will start over again, every time it is finished |
muted | muted | Specifies that the audio output of the video should be muted |
poster | URL | Specifies an image to be shown while the video is downloading, or until the user hits the play button |
preload |
| Specifies if and how the author thinks the video should be loaded when the page loads |
src | URL | Specifies the URL of the video file |
width | pixels | Sets the width of the video player |
Global Attributes
Global attributes are HTML tag attributes that can be used by any tag, hence the name "global". They are in contrast to unique attributes that are tag-specific.
<video> supports global attributes.
Event Attributes
Event attributes are HTML tag attributes that allow triggering actions upon specific conditions, hence the name "event". Other types of attributes, namely global and unique attributes, can also trigger actions, but the difference is that even attributes allow calling scripts, such as JavaScript functions, while most other attributes only support a certain type of action.
<video> supports event attributes.