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.

TagDescription
<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 -

AttributeDescriptionValues
heightSpecifies the height of the plug-in. Number in pixels.
srcSpecifies the embedded resource location.URL
typeSpecifies the linked resource typetype
widthSpecifies 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 -

AttributeDescriptionValues
alignSpecifies the alignment of object.Not supported in HTML5leftrighttopbottommiddle
ArchiveSpecifies the archive location of objectNot supported in HTML5URL
BorderSpecifies the object border width.Not supported in HTML5Number/pixels
CodebaseSpecifies the object code location.Not supported in HTML5URL
CodetypeSpecifies the object media type.Not supported in HTML5Media_type
dataSpecifies the resource locationURL.
DeclareSpecifies the object should be declared.Not supported in HTML5Declare
formSpecifies the object associated form.HTML5 attributeForm_id
heightSpecifies the object heightNumber/pixels
HspaceSpecifies the space on the left and right side of the object.Not supported in HTML5Number/pixels
nameSpecifies the object nameText
typeSpecifies the type of linked resource to objectMedia_type
usemapSpecifies the image map name.#mapname
widthSpecifies the object widthNumber/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 -

Browser do not support object tag

<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 -

AttributeDescription
BalanceDefines the volume divided between the speakers.The values in between -10000 to +10000
LoopThe attribute indicates the number of times a sound is to be playedThe values are numbers or “infinite”
SrcSpecifies the URL of the sound file
VolumeSpecifies 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>

Output -

Background sound is not playing as bgsound tag not supporting in HTML5.