TL;DR – HTML objects and plugins are media elements that can be embedded in a webpage from an external source to provide additional functionalities.
Why Add Multimedia?
While HTML tags and elements provide you with a variety of possibilities, there are some things they won't help you create. Stuff like audio, video, or applets has to be embedded for an external source.
HTML objects and plugins can also be called HTML multimedia. This term represents all mediums of communication. Embedded objects help to create impressive designs, add dynamicity and provide additional functionalities. All of these options help you improve the user experience. You can embed media to HTML using a file or a web address.
Embed HTML Objects and Plugins Using the Right Tags
The HTML <object> element specifies an embedded object in the document. It can be used to embed multimedia files or another web page in HTML:
<object width="400" height="300" data="example.ex">
The <embed> tag can also be used for specifying embedded objects in web documents, mostly HTML plugins and external applications:
<embed width="400" height="300" src="example.ex">
Note: the <embed> element won't work in HTML4 and older versions.
<img src="image.png" alt="Space Doggo" width="50" height="50">
<audio controls> <source src="bitdegree.org/learn/I_Cactus_-_05_-_ruby_cactus.mp3" type="audio/mpeg""> <p>If audio does not start, the <audio> HTML element is not supported in your browser.</p> </audio>
<video controls width="400" height="300"> <source src="video-tag-example.mp4" type="video/mp4"> <source src="video-tag-sample.webm" type="video/webm"> <source src="video-tag-demo.ogg" type="video/ogg"> Video tag is not supported in this browser. </video>
Note: using the HTML <video> tags means you don't need to embed Flash in HTML, as the native HTML5 element has a much better browser support.
HTML Audio and Video Formats
To add audio and video to your website, you need to be aware of what formats you may choose. See the list of the available formats in the tables below.
Theory is great, but we recommend digging deeper!
|AAC||audio/mp4, audio/aac, audio/aacp|
HTML Object and Plugins: Useful Tips
- Don't embed SWF files in HTML, as Shockwave Flash has been discontinued. Currently, the native HTML5 tags are supported much better.
- Always make sure viewing your HTML plugin doesn't require special software. For example, a lot of Java applets are no longer displayed because most browsers stopped supporting the NPAPI (Netscape Plugin Application Programming Interface) plugin.