CodesJava

Easy learning with example program codes

video HTML

HTML <video> Tag

For streaming a video file on a web page the HTML <video> tag is used. It supports three video formats currently, mp4, webM and ogg.

List of different video file format supported by the browsers:

BrowserMP4WebMOgg
Internet ExplorerYESNONO
ChromeYESYESYES
FirefoxYESYESYES
SafariYESNONO
OperaYESYESYES

Example:

<!DOCTYPE html>
<html>
<body>
<h3>Example:</p>
<video width="300" height="200" controls>
  <source src="mov123.mp4" type="video/mp4">
  <source src="mov123.ogg" type="video/ogg">
</video>
</body>
</html>

Output:

Explanation:

In the above example, we used the HTML <video> tag to stream a video file on an HTML page.

Tag specific Attributes:

AttributeValueUses
autoplayautoplayUsed to indicate that the video will start playing automatically when it is ready to play.
controlscontrolsUsed to indicate that the video controls should be displayed.
heightpixelsUsed to define the height of the video player.
looploopUsed to indicate that when finished, the video will start over again each time.
mutedmutedUsed to indicate that the audio output of the video is muted.
posterURLUsed to render an image when the video downloads, or until the user hits the play button.
preloadauto

metadata

none

Used to determine if and how the author thinks the video should be loaded when the page loads.
srcURLUsed to define the URL of the video file.
widthpixelsUsed to define the width of the video player.

MIME Types for HTML Video format:

Video FormatMIME Type
MP4video/mp4
Oggvideo/ogg
WebMvideo/webM

Global Attributes:

The HTML Global attributes are supported by the HTML <video> tag.

Event Attributes:

The HTML Event attributes are supported by the HTML <video> tag.

Supporting Browsers:

Chrome, IE, Firefox, Opera and Safari.

Please follow and like us:
error
Posted in HTML   









Copyright © 2019 CodesJava DMCA.com Protection Status