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 = "https://www.lecturely.com/wp-content/themes/divi-child/asset/img/" width = "100%" height = "60" > <noembed><img src = "image-68.png" alt = "Alternative Media" ></noembed> </embed>
HTML <embed> Tag Attribute
Following is the list of important attributes which can be used with <embed> tag.
|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 an alternate option for loop if you are using 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 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 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 same meaning as explained above.
<bgsound src = "/html/yourfile.mid"> <noembed><img src = "yourimage.gif" ></noembed> </bgsound>
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> </object>
Here alt attribute will come into picture if the browser does not support object tag.