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

The <embed> tag defines a container for an external resource, such as a web page, a picture, a media player, or a plug-in application.

We can also include a <noembed> tag for the browsers which don’t recognize the <embed> tag. We could, for example, use <embed> to display a movie of your choice, and <noembed> to display a single JPG image if the browser does not support <embed> tag.

<embed src = "" width = "100%" height = "60" >
         <noembed><img src = "image-68.png" alt = "Alternative Media" ></noembed>

HTML <embed> Tag Attribute

Following is the list of important attributes which can be used with <embed> tag.

AlignDetermines how to align the object. It can be set to either center, left or right.
AutostartThis Boolean attribute indicates if the media should start automatically. You can set it either true or false.
LoopSpecifies if the sound should be played continuously (set loop to true), a certain number of times (a positive value) or not at all (false)
PlaycountSpecifies the number of times to play the sound. This is an alternate option for loop if you are using IE.
HiddenSpecifies if the multimedia object should be shown on the page. A false value means no and true values means yes.
WidthWidth of the object in pixels
HeightHeight of the object in pixels
NameA name used to reference the object
SrcURL of the object to be embedded.
VolumeControls the volume of the sound. Can be from 0 (off) to 100 (full volume).

Warning! The align and autostart attributes deprecated in HTML5. Do not use these attributes.

HTML Supported Video Types

We can use various media types like Flash movies (.swf), AVI’s (.avi), and MOV’s (.mov) file types inside the 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.         

HTML Background Audio

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

This tag is having only two attributes loop and src. Both these attributes have the same meaning as explained above.

<bgsound src = "/html/yourfile.mid">
   <noembed><img src = "yourimage.gif" ></noembed>

HTML Object Tag

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.

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

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