HTML <video> Tag
<video src="http://www.htmlcodes.ws/resources/countdown.ogg" width="300" height="150" controls>
<p>If you are reading this, it is because your browser does not support the HTML5 video element.</p>
</video>
The above example demonstrates usage of the <video>
element.
The <video>
element allows you to embed videos or movies, and audio files with captions within your HTML documents.
The URL of the video file is provided in the src
attribute. You can also use the following attributes to determine the display and behavior of the video.
Attributes
As well as the global HTML attributes, you can use the following attributes with the <video>
element:
src
- URL of the video file.
crossorigin
- How the element handles crossorigin requests.
poster
- Poster frame to show prior to video playback.
preload
- Hints how much buffering the media resource will likely need.
autoplay
- Hint that the media resource can be started automatically when the page is loaded.
mediagroup
- Groups media elements together with an implicit MediaController.
loop
- Whether the video should loop (i.e. play continously, going back to the start each time it reaches the end).
muted
- Whether to mute the sound by default.
controls
- Show user agent controls (enables the user to do things like change the volume, pause, etc).
width
- Horizontal dimension.
height
- Vertical dimension.
Also see the <track> element for providing subtitles or other text tracks.