Summary -
In this topic, we described about the below sections -
Embed multimedia is nothing but adding media files(video, audios) to the HTML document. HTML allows adding multimedia to the HTML page. There are three ways of adding multimedia to HTML document.
Tag | Description |
---|---|
<embed> | Embedding an external application or content into the current HTML documents |
<object> | Embedded object or external object in an HTML documents |
<bgsound> | used to insert a background audio track in an HTML Page |
<embed>
The <embed> tag is new in HTML5. Embedding an external application or content into the current HTML documents. The <embed> tag is used to insert an external application or content into an HTML document.
The tag can be specified like <embed src="" type=""> with the URL of the embedded resource added to the src attribute. Most of the browsers have supported the <embed> tag for a long time. <embed> tag has no content and therefore does not warrant a closing tag.
Syntax -
<embed>.. text here.. </embed>
Below media types can be used inside embed tag.
- .swf files - Macromedia's Flash program.
- Avi files - Audio Video Interleaved
- .wmv files - Microsoft's Window's Media Video file types.
- .mov files - Apple's Quick Time Movie format.
- .mpeg files - Moving Pictures Expert Group.
Optional Attributes -
Attribute | Description | Values |
---|---|---|
height | Specifies the height of the plug-in. | Number in pixels. |
src | Specifies the embedded resource location. | URL |
type | Specifies the linked resource type | type |
width | Specifies the width of the plug-in. | Number in pixels |
Example -
<!DOCTYPE html>
<html>
<head>
<title>Embed tag example.. </title>
</head>
<body>
<embed src="img/logo.png" height="120px" weight="300px">
</body>
</html>
Output -
<object>
Embedded object or external object in an HTML documents. The <object> tag represents an embedded object in an HTML document. External object can be an image, external resource and plugin etc,. The tag can be specified like <object type=""></object> or <object data=""></object>.
Type and data attributes are mandatory and atleast one of the attribute is needed along with <object> tag. <object> tag can be used to embed multimedia also in to the HTML document. lt;object> tag can be used to embed another webpage also in to the HTML document.
An <object> element should be coded inside the <body> element. The text between the <object> and </object> is an fallback text. Objects are no longer appear inside the <head> element of a document in HTML5.
Syntax -
<object>….</object>
Optional Attributes -
Attribute | Description | Values |
---|---|---|
align | Specifies the alignment of object.Not supported in HTML5 | leftrighttopbottommiddle |
Archive | Specifies the archive location of objectNot supported in HTML5 | URL |
Border | Specifies the object border width.Not supported in HTML5 | Number/pixels |
Codebase | Specifies the object code location.Not supported in HTML5 | URL |
Codetype | Specifies the object media type.Not supported in HTML5 | Media_type |
data | Specifies the resource location | URL. |
Declare | Specifies the object should be declared.Not supported in HTML5 | Declare |
form | Specifies the object associated form.HTML5 attribute | Form_id |
height | Specifies the object height | Number/pixels |
Hspace | Specifies the space on the left and right side of the object.Not supported in HTML5 | Number/pixels |
name | Specifies the object name | Text |
type | Specifies the type of linked resource to object | Media_type |
usemap | Specifies the image map name. | #mapname |
width | Specifies the object width | Number/pixels. |
Example -
<!DOCTYPE html>
<html>
<head>
<title>Object tag example..</title>
</head>
<body>
<object width="50" height="50" data="img/logo.png">
Browser do not support object tag
</object>
</body>
</html>
Output -
<bgsound>
Deprecated in HTML5. The <bgsound> element was used to insert a background audio track in an HTML Page. The <bgsound> element was introduced by Microsoft into the Internet Explorer browser.
So no other browsers are supports the <bgsound> tag. It allowed web designers to add a background audio loop to a website in internet explorer. It is no longer supported.
This feature is non-standard and is not on a standards track. The <audio> element can be used to add background sounds instead of <bgsound> tag. But it has autoplay attribute and can’t be disabled.
Below are the attributes of bgsound -
Attribute | Description |
---|---|
Balance | Defines the volume divided between the speakers.The values in between -10000 to +10000 |
Loop | The attribute indicates the number of times a sound is to be playedThe values are numbers or "infinite" |
Src | Specifies the URL of the sound file |
Volume | Specifies the loudnessThe value is between -10000 and 0 |
Syntax -
<bgsound>….</bgsound>
Example -
<!DOCTYPE html>
<html>
<head>
<title>Bgsound tag example..</title>
</head>
<body>
<bgsound src="audio/new.mpg">
</body>
</html>