HTML Embed Multimedia
HTML <bgsound> tag
When writing in HTML, the <bgsound> tag is used to embed sound files in to a web page. Because the
sound file plays automatically when the page loads, and this tag is only supported in Internet Explorer, we
recommend using <audio> instead. The following sections contain information about the <bgsound> tag,
including an example of its code, and related attributes and browser compatibility.
<bgsound src="[Link]
Attributes
Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up
of a name and value pair; all tags support standard attributes. The following table shows all of the current
unique HTML attributes for the <bgsound> tag, and a description of each.
Attribute Description
balance Designates how the audio is split between speakers.
loop Designates that the audio file should continuously repeat.
src Designates the URL of the audio file.
volume Designates the default volume for the audio file.
Compatibility
Internet Explorer Firefox Safari Opera Chrome
All versions Not supported Not supported Not supported Not supported
<embed> Tag
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
Here is a simple example to play an embedded midi file −
<!DOCTYPE html>
<html>
<head>
<title>HTML embed Tag</title>
</head>
<body>
<embed src = "/html/[Link]" width = "100%" height = "60" >
<noembed><img src = "[Link]" alt = "Alternative Media" ></noembed>
</embed>
</body>
</html>
The <embed> Tag Attributes
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.
[Link] Attribute & Description
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
Height of the object in pixels
8 name
A name used to reference the object.
9 src
URL of the object to be embedded.
10 volume
Controls volume of the sound. Can be from 0 (off) to 100 (full volume).
Supported Video Types
You can use various media types like Flash movies (.swf), AVI's (.avi), and MOV's (.mov) file types
inside embed tag.
✓ .swf files − are the file types created by Macromedia's Flash program.
✓ .wmv files − are Microsoft's Window's Media Video file types.
✓ .mov files − are Apple's Quick Time Movie format.
✓ .mpeg files − are movie files created by the Moving Pictures Expert Group.