Previous Next

HTML Embed Multimedia

HTML <embed> element is used to embed a multimedia in HTML document.

Browser may include multimedia controls if supported by the browser.

Use <noembed> tag to show alternative content if embed is not supported by the browser.

Example

<!DOCTYPE html>
<html>
<head>
<title>HTML embed Tag</title>
</head>
<body>
<embed src="/images/html/video.mp4"  >
   <noembed><img src="yourimage.gif" alt="Alternative Media" ></noembed>
</embed>
</body>
</html>

Result:


 

HTML <embed> Tag Attributes

Attribute Description
align Determines how to align the object. It can be set to either center, left or right.
autostart This boolean attribute indicates if the media should start automatically. You can set it either true or false.
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)
playcount Specifies the number of times to play the sound. This is alternate option for loop if you are usiong IE.
hidden Specifies if the multimedia object should be shown on the page. A false value means no and true values means yes.
width Width of the object in pixels
height Height of the object in pixels
name A name used to reference the object.
src URL of the object to be embedded.
volume Controls volume of the sound. Can be from 0 (off) to 100 (full volume).

HTML 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.
<!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>

HTML Background Audio

HTML <bgsound> tag is used to play a soundtrack in the background of the webpage.

Sound will be played when browser loads the document.

<bgsound> tag has two attributes loop and src, as explained above.

Example

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

 


 

HTML Object tag

The <object> tag defines an embedded object within an HTML document.

Use this element to embed multimedia (like audio, video, Java applets, ActiveX, PDF, and Flash) in your web pages.

You can also use the <object> tag to embed another webpage into your HTML document.

You can use the <param> tag to pass parameters to plugins that have been embedded with the <object> tag.

Here are few examples:

Example - 1

You can embed an HTML document in an HTML document itself as follows:

<object data="data/test.htm" type="text/html" width="300" height="200">
  alt : <a href="data/test.htm">test.htm</a>
</object>

Here alt attribute will come into picture if browser does not support object tag.

Example - 2

You can embed a PDF document in an HTML document as follows:

<object data="data/test.pdf" type="application/pdf" width="300" height="200">
  alt : <a href="data/test.pdf">test.htm</a>
</object>

Example - 3

You can specify some parameters related to the document with the <param> tag. Here is an example to embed a wav file:

<object data="data/test.wav" type="audio/x-wav" width="200" height="20">
  <param name="src" value="data/test.wav">
  <param name="autoplay" value="false">
  <param name="autoStart" value="0">
  alt : <a href="data/test.wav">test.wav</a>
</object>

Example - 4

You can add a flash document as follows:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="penguin" 
   codebase="someplace/swflash.cab" width="200" height="300">
   <param name="movie" value="flash/penguin.swf" />
   <param name="quality" value="high" />
   <img src="penguin.jpg" width="200" height="300" alt="Penguin" />
</object>

Example - 5

You can add a java applet into HTML document as follows:

<object classid="clsid:8ad9c840-044e-11d1-b3e9-00805f499d93" 
   width="200" height="200">
   <param name="code" value="applet.class">
</object>

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.


Previous Next