Define Video Attribute Specification in HTML5

In this article I will explain Define Video Attribute in HTML5.
  • 1955

Use Video in HTML5

Most commonly used video formats are:

  • mpeg4: MPEG4 files with H.264 video codec and AAC audio codec

  • Ogg: Ogg files with Thedora video codec and Vorbis audio codec.

HTML5 Video Tags

  • <video> Defines a video or movie.

  • <source> Defines multiple media resources for media elements, such as <video> and <audio>.

  • <track> Defines text tracks in media players.

You can use <source> tag to specify media along with media type and many other attributes. A video element allows multiple source elements and browser will use the first recognized format:

<video width="300" height="200" controls autoplay>
   <source src="sample.mp4" type="video/mp4">
   <source src="sample.ogv" type="video/ogg">
   <source src="sample.webm" type="video/webm">
    Brower does not support video element

Video Attribute Specification:

The HTML5 video tag can have a number of attributes to control the look and feel and various functionalities of the control:

  • src  This attribute is optional, The URL of the video to embed; you may instead use the <source> element within the video block to specify the video to embed

  • autoplay This boolean attribute if specified, the video will automatically begin to play back as soon as it can do so without stopping to finish loading the data.

  • autobuffer  This boolean attribute if specified, the video will automatically begin buffering even if it's not set to automatically play.

  • loop This boolean attribute if specified, It will allow video automatically seek back to the start after reaching at the end.

  • controls If this attribute is present, It will allow the user to control video playback, including volume, seeking, and pause/resume playback.

  • preload This attribute specifies that the video will be loaded at page load, and ready to run. Ignored if autoplay is present.

  • poster This attribute is a URL of an image to show until the user plays or seeks.

  • width This attribut specifies the width of the video's display area, in CSS pixels.

  • height This attribut specifies the height of the video's display area, in CSS pixels.

Further Readings

You may also want to read these related articles :

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.