HTML Lesson 8

Goto Lesson:

Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Just as with images there is only one command to embedding movies or sound into your page. This tag has several options included with it, the first being the src option which works exactly the same way as the src command with images. Examine the example below and then read the explanation that follows.

<html>
<head>
<title>Embedding media</title>
</head>
<body>
<embed src="video.mpg" width="250" height="250" loop="5" autostart="true" hidden="false">
</body>
</html>


The command for embedding is simply embed, so we state our command then we space and enter our first option (src). You should remember how to use src from the previous tutorial on images. So are example is looking for a file called video.mpg in the same directory as the page and will put it on the page. The width and height options will set the width and height of the movie screen. Loop sets the number of times the movie will play through before it stops (set to true for an infinite loop). Autostart claims whether the movie will start playing autmatically or not, it is either true of false. Hidden says whether the player should be shown or invisible to the viewer, it is also either true of false. The embed is not limited to only embedding music it can be used for almost all media types including but not limited to: mpg, wav, mid, swf, avi, etc. The hidden tag comes in handy when you want to embed background music.

Another simpler way to embed background music is to put it in the body tag as an option. If you just want background sound embedded put the bgsound option in the body tag like so:

<html>
<head>
<title>sound example</title>
</head>
<body bgsound="music.mid">
There is background music on this page.
</body>
</html>


Keep in mind that this example relies on the fact that there are is a file named music.mid in the same directory as the page. If you want to use background music the best type of file you can use is a .mid or midi because they load relatively fast compared to any other type. Midi's of almost any song you want can be found on the web (without words because midis do not support vocals). Now that you know how to put media on your page you need an effective way of organization. This is where tables come in progress to the next lesson to learn more about them.