Media Elements
Media Elements
Before HTML5
In today's web development, multimedia content such as audio and video plays a crucial role in enhancing user
engagement and providing a richer experience. Traditionally, embedding media on web pages relied heavily on
third-party plugins like Adobe Flash, which had several drawbacks, including compatibility issues, security
vulnerabilities, and the need for additional installations.
After HTML5
With the introduction of HTML5, embedding multimedia content became more streamlined and efficient. HTML5
introduced new elements specifically designed to handle audio and video, eliminating the need for external plugins
and improving cross-browser compatibility and accessibility.
1. <audio> Element
Purpose:
Embeds audio content.
Attributes:
Example
0:00 / 2:32
2. <video> Element
Purpose:
Embeds video content.
Attributes:
controls: Adds video controls (play, pause, volume, fullscreen, and seek controls.).
autoplay: Automatically starts playing the video.
loop: Repeats the video.
muted: Mutes the video.
src: Specifies the path to the video file.
width and height: Specifies the dimensions of the video player.
poster: Specifies an image to be shown while the video is downloading or until the user hits the play button.
Example
0:04 / 0:21
embed tag
The tag in HTML is used to embed external content within a webpage. This content can be multimedia elements
such as audio, video, or interactive objects like PDFs . The <embed> tag is versatile and can be used to integrate a
variety of external resources.