2. Definition and Usage
The <audio> tag defines sound, such as music or other audio streams.
Currently, there are 3 supported file formats for the <audio> element:
MP3, Wav, and Ogg
<audio controls>
<source src=/slideshow/fybsc-it-web-programming-unit-ii-audio-video-in-html/232575564/"horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
3. Attributes
Attribute Value Description
autoplay autoplay Specifies that the audio will start playing as soon as it is ready
controls controls
Specifies that audio controls should be displayed (such as a
play/pause button etc)
loop loop Specifies that the audio will start over again, every time it is
muted muted Specifies that the audio output should be muted
preload
auto
metadata
none
Specifies if and how the author thinks the audio should be loaded
when the page loads
src URL Specifies the URL of the audio file
4. HTML <video> Tag
The <video> tag specifies video, such as a movie clip or other video
streams.
Currently, there are 3 supported video formats for the <video> element:
MP4, WebM, and Ogg
<video width="320" height="240" controls>
<source src=/slideshow/fybsc-it-web-programming-unit-ii-audio-video-in-html/232575564/"movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
5. Optional Attributes
Attribute Value Description
Autoplay autoplay Specifies that the video will start playing as soon as it is ready
Controls controls
Specifies that video controls should be displayed (such as a
play/pause button etc).
Height pixels Sets the height of the video player
Loop loop
Specifies that the video will start over again, every time it is
finished
Muted muted Specifies that the audio output of the video should be muted
Poster URL
Specifies an image to be shown while the video is
or until the user hits the play button
Preload
auto
metadata
none
Specifies if and how the author thinks the video should be
loaded when the page loads
src URL Specifies the URL of the video file
width pixels Sets the width of the video player