HTML - Embed Multimedia
HTML - Embed Multimedia
Sometimes you need to add music or video into your web page. The easiest way to add video or
sound to your web site is to include the special HTML tag called <embed>. This tag causes the
browser itself to include controls for the multimedia automatically provided browser supports
<embed> tag and given media type.
You can also include a <noembed> tag for the browsers which don't recognize the <embed> tag.
You could, for example, use <embed> to display a movie of your choice, and <noembed> to
display a single JPG image if browser does not support <embed> tag.
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML embed Tag</title>
</head>
<body>
<embed src = "/html/yourfile.mid" width = "100%" height = "60" >
<noembed><img src = "yourimage.gif" alt = "Alternative Media" ></noembed>
</embed>
</body>
</html>
Following is the list of important attributes which can be used with <embed> tag.
Note −The align and autostart attributes deprecated in HTML5. Do not use these attributes.
https://www.tutorialspoint.com/html/html_embed_multimedia.htm 1/6
7/25/2020 HTML - Embed Multimedia - Tutorialspoint
1
align
Determines how to align the object. It can be set to either center, left or right.
2
autostart
This boolean attribute indicates if the media should start automatically. You can set it
either true or false.
3 loop
Specifies if the sound should be played continuously (set loop to true), a certain number
of times (a positive value) or not at all (false)
4
playcount
Specifies the number of times to play the sound. This is alternate option for loop if you
are usiong IE.
5
hidden
Specifies if the multimedia object should be shown on the page. A false value means no
and true values means yes.
6
width
Width of the object in pixels
7 height
8 name
9 src
10
volume
https://www.tutorialspoint.com/html/html_embed_multimedia.htm 2/6
7/25/2020 HTML - Embed Multimedia - Tutorialspoint
Controls volume of the sound. Can be from 0 (off) to 100 (full volume).
Live Demo
<!DOCTYPE html>
<html>
<head>
<title>HTML embed Tag</title>
</head>
<body>
<embed src = "/html/yourfile.swf" width = "200" height = "200" >
<noembed><img src = "yourimage.gif" alt = "Alternative Media" ></noembed>
</embed>
</body>
</html>
Background Audio
https://www.tutorialspoint.com/html/html_embed_multimedia.htm 3/6
7/25/2020 HTML - Embed Multimedia - Tutorialspoint
You can use HTML <bgsound> tag to play a soundtrack in the background of your webpage. This
tag is supported by Internet Explorer only and most of the other browsers ignore this tag. It
downloads and plays an audio file when the host document is first downloaded by the user and
displayed. The background sound file also will replay whenever the user refreshes the browser.
Note − The bgsound tag is deprecated and it is supposed to be removed in a future version of
HTML. So they should not be used rather, it's suggested to use HTML5 tag audio for adding sound.
But still for learning purpose, this chapter will explain bgsound tag in detail.
This tag is having only two attributes loop and src. Both these attributes have same meaning as
explained above.
<!DOCTYPE html>
<html>
<head>
<title>HTML embed Tag</title>
</head>
<body>
<bgsound src = "/html/yourfile.mid">
<noembed><img src = "yourimage.gif" ></noembed>
</bgsound>
</body>
</html>
This will produce the blank screen. This tag does not display any component and remains hidden.
Internet Explorer can also handle only three different sound format files − wav, the native format for
PCs; au, the native format for most Unix workstations; and MIDI, a universal music-encoding
scheme.
HTML 4 introduces the <object> element, which offers an all-purpose solution to generic object
inclusion. The <object> element allows HTML authors to specify everything required by an object
for its presentation by a user agent.
Here are a few examples −
Example - 1
https://www.tutorialspoint.com/html/html_embed_multimedia.htm 4/6
7/25/2020 HTML - Embed Multimedia - Tutorialspoint
Here alt attribute will come into picture if browser does not support object tag.
Example - 2
Example - 3
You can specify some parameters related to the document with the <param> tag. Here is an
example to embed a wav file −
Example - 4
Example - 5
https://www.tutorialspoint.com/html/html_embed_multimedia.htm 5/6
7/25/2020 HTML - Embed Multimedia - Tutorialspoint
The classid attribute identifies which version of Java Plug-in to use. You can use the optional
codebase attribute to specify if and how to download the JRE.
https://www.tutorialspoint.com/html/html_embed_multimedia.htm 6/6