Introduction
On the internet, we have multimedia like images, music, videos, and animations. The concepts of multimedia in HTML that we will learn in this blog will be helpful when you want to add music or songs or videos to your web page. You can add various multimedia elements on your web pages using tags like AUDIO, VIDEO, EMBED, and OBJECT. Multimedia files can be recognised using extensions like .wav, .mp3, .mp4, .mpg, .wmv, and .avi.
HTML supports only these video standards:
- MP4
- WebM
- Ogg
Let’s talk about audio files now. These are the formats supported by HTML:
- MP3
- WAV
-
Ogg
Now is the time to discuss different types of tags used for embedding multimedia in HTML:
Video Tag in HTML
The <video> tag in HTML is used for streaming movie clips or song clips on the web page.Let’s understand it with an example:
<!DOCTYPE html> <html> <body>
<!-- Video tag of HTML--> <video width="320" height="240" controls> <source src="CN.mp4" type="video/mp4"> <source src="CN.ogg" type="video/ogg"> Coding Ninjas </video>
</body> </html>
|
Output: |
Attributes Of HTML Video tags
Attribute |
Description |
controls | It shows the video controls which are displayed with play/pause buttons. |
height | It sets the height of the video player. |
width | It sets the width of the video player. |
poster | It is used to specify the image which is displayed on the screen when the video is not played. |
autoplay | It will play the video as soon as it is ready. |
src | It is used to specify the source URL of the video file. |
loop | Due to this video file will loop over again on completion. |
muted | You can use it when you want a mute video output. |
preload | It is used to show the author’s view to upload a video file when the page loads. |
So this is how you can add video clips to your web pages and can add several functionalities to it using attributes. Now let’s move towards audio files: