JavaScript Tutorial

HTML Embed Multimedia

If you want to include multimedia content such as music or video on your web page, you can use the <embed> tag in HTML. The <embed> tag allows you to embed external resources like web pages, pictures, media players, or plug-in applications within your web page.

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.

HTML <embed> tag attribute

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

Tag

Description

Align

Determines how to align the object. It can be set to either center, left, or right.

Autostart

This boolean value indicates if the media should start automatically. You can set it to 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 a true value 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).

Just a quick clarification: The align and autostart attributes are not supported in HTML5, but they are not officially deprecated. They are still supported in some browsers for backward compatibility, but the recommended approach is to use CSS for alignment and the autoplay attribute for autostarting multimedia.

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

Note:It's worth noting that the use of Flash is no longer recommended due to security vulnerabilities and lack of support on modern devices. Instead, HTML5 introduced native video support which allows for the playback of video content directly within the browser without the need for plugins. The most widely supported video file types for HTML5 video are MP4, WebM, and Ogg.

HTML background audio

We can use the HTML <bgsound> tag to play a soundtrack in the background of a webpage. However, this tag is only supported by Internet Explorer, and most other browsers will ignore it. The tag downloads and plays an audio file when the host document is first downloaded and displayed by the user. The background sound file will also replay whenever the user refreshes the browser.

The <bgsound> tag only has two attributes: loop and src. These attributes have the same meaning as previously explained.

As the <bgsound> tag is actually obsolete and no longer supported in modern browsers, you can use the <audio> tag to add background audio to a webpage.

HTML object tag

The HTML <object> element was introduced in HTML 4 and provides a way to include generic objects. It allows HTML authors to specify all the necessary information for an object's presentation by a user agent. The <object> tag can be used for a wide range of objects, such as images, audio, video, Flash animations, and even other HTML documents.

When the browser does not support the <object> tag, the content of the <alt> attribute will be displayed.

Go back to Previous Course