Skip to main content

HTML Multimedia

What is Multimedia?


* How it Works

The controls attribute adds video controls, like play, pause, and volume.
It is a good idea to always include width and height attributes. If height and width are not set, the page might flicker while the video loads.
The <source> element allows you to specify alternative video files which the browser may choose from. The browser will use the first recognized format.
The text between the <video> and </video> tags will only be displayed in browsers that do not support the <video> element.

* HTML <video> Autoplay

To start a video automatically use the autoplay attribute:

Example

<video width="320" height="240" autoplay>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>

Example 2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div style="margin-left:30%;">
<h3> For Example </h3>
<video src="mov_bbb.mp4height="300px,width="300px;controls>
</video>
</div>
</body>
</html>





The HTML <audio> Element

To play an audio file in HTML, use the <audio>element:

Example

<audio controls>
  <source src="horse.ogg"type="audio/ogg">
  <source src="horse.mp3"type="audio/mpeg">
Your browser does not support the audio element.
</audio>

HTML Audio - How It Works

The controls attribute adds audio controls, like play, pause, and volume.
The <source> element allows you to specify alternative audio files which the browser may choose from. The browser will use the first recognized format.
The text between the <audio> and </audio>tags will only be displayed in browsers that do not support the <audio> element.

Comments