HTML Media
HTML allows you to embed multimedia files like videos and audio directly into your web pages.
The <video> Element
The <video> tag is used to embed video content in a document. The controls attribute adds video controls, like play, pause, and volume.
Example: Embedding a Video
html
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>The <audio> Element
The <audio> tag is used to embed sound content in a document. The controls attribute adds audio controls, such as play, pause, and volume.
You can add multiple <source> elements. The browser will use the first recognized format.
Example: Embedding Audio
html
<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>Test Yourself with an Exercise
Which attribute adds player controls like play, pause, and volume to a <video> or <audio> element?