HTML Tag: video
Video or captioned audio file.
source elements can be used in a video element to point to alternative resources.
track elements can be used to assign text tracks, such as subtitles.
Any additional content is treated as fallback content, that is, content that a browser will call into play if the video fails to work (if the resource isn’t found, or if the browser is too ancient to understand the video element, for example).
Optional Attributes
| Attribute | Description | Possible values |
|---|---|---|
src |
The location of the video file to be used. | URL. |
poster |
An image to act as a holding frame before playback begins. | URL. |
preload |
How much the video should be buffered. |
|
autoplay |
Annoys the user by automatically playing the video on loading. | None. |
loop |
Constantly replays the video once it has finished. | None. |
muted |
Mutes the video resource by default. | None. |
controls |
Instructs the browser to apply its own in-built set of user controls (to stop, play, mute, etc.). | None. |
mediagroup |
Groups together several video and/or audio elements. Those elements sharing the same mediagroup value become part of the same group. |
Text. |
width |
The width of the video in pixels. This can also be done, or overridden, with CSS. | Number. |
height |
The height of the video in pixels. This can also be done, or overridden, with CSS. | Number. |
crossorigin |
Used in conjunction with JavaScript to determine how Cross Origin Resource Sharing requests are handled. |
|
| Global attributes | ||
Example
<video src="kitties.mp4" width="300" height="200" loop controls poster="kittiesTitle.jpg">
<img src="hahahaha.jpg" alt="Hilarious cat and caption saying 'soz'.">
</video>
