<video> tag

HTML5 <video> tag

The <video> element is used to embed video in web page.

Syntax:
<video controls src=”videofilename.file-type”  type=”video/file-type”>

Example

<video width="320" height="240" controls>
  <source src="media/video/HTML5_Dog.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

Default CSS Value

NONE

How Browser will display

BLOCK Level.

Difference between HTML4.01, XHTML and HTML5

HTML4 XHTML HTML5
NA NA New tag in HTML5

Attributes used with <video> tag

Attribute Description
src Defines the path URL of the source file. You can also use the <source> tag with this attribute.
width Describes the width of the video in pixels.
height Describes the height of the video in pixels.
autoplay This enables the video to automatically play when the user loads the page containing the video element.
controls It has the controls buttons like volume, play/pause, mute/unmute, zoom in/out screen, download link etc
muted To mute the sound of the video file at start by default.
loop To play the video again and again in a loop
preload To decide how the video will be preloaded at start of the page loading. It can take values as -
  • auto - to automatically load the entire video once the page loads
  • metadata - to only load the metadata once the page loads
  • none - NOT to load the video once the page loads
  • poster It set an image on the screen before video starts playing. You need to set the URL of the image.

    Global Attributes

    The <video> tag supports Global attributes.

    Event Attributes

    The <video> tag supports Event attributes.

    Supporting Browsers

    video tag supporting browser

    Related Tags

    <audio> , <source> and  <track>.

    Tutorials for all brains!