Search This Blog

Benjamin Philip. Theme images by Roofoo. Powered by Blogger.

Comments

Translate

Recent

HTML Embed Multimedia

SHARE:

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>. This tag causes the browser itself to include controls for the multimedia automatically provided browser supports <embed> tag and given media type.
You can also include a <noembed> tag for the browsers which don't recognize the <embed> tag. You could, for example, use <embed> to display a movie of your choice, and <noembed> to display a single JPG image if browser does not support <embed> tag.

Example

Here is a simple example to play an embedded midi file:
<!DOCTYPE html>
<html>
<head>
<title>HTML embed Tag</title>
</head>
<body>
<embed src="/html/yourfile.mid" width="100%" height="60" >
   <noembed><img src="yourimage.gif" alt="Alternative Media" ></noembed>
</embed>
</body>
</html>
This will produce following result:
You can put any media file in src attribute. You can try it yourself by giving various types of files.

The <embed> Tag Attributes

Following is the list of important attributes which can be used with <embed> tag.
AttributeDescription
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 alternate option for loop if you are usiong 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 volume of the sound. Can be from 0 (off) to 100 (full volume).

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>
This will produce following result:

Background Audio

You 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.
Here is a simple example to play a small midi file:
<!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>
This will produce blank screen. This tag does not display any component and remains hidden.
Internet Explorer can also handle only three different sound format files: wav, the native format for PCs; au, the native format for most Unix workstations; and MIDI, a universal music-encoding scheme.

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

COMMENTS

Name

android,6,Arduino,4,Blogs,10,C Programming,26,Computer,18,Electronic,12,HTML,22,Mobile,13,NEWS W,2,PHP,8,Programming,1,Project,9,Tutorial,7,
ltr
item
GetYarn: HTML Embed Multimedia
HTML Embed Multimedia
HTML Embed Multimedia
GetYarn
https://getyarn.blogspot.com/2017/07/html-embed-multimedia.html
https://getyarn.blogspot.com/
http://getyarn.blogspot.com/
http://getyarn.blogspot.com/2017/07/html-embed-multimedia.html
true
6634423068030231660
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy