Back to Menu!

Embedding for Smart People I just can't call you people "dummies" no matter how hard I want to. Below is a quick rundown of the basic embed commands straight from my other stunning embedding tutorial, So You Want To Embed, Huh?.

The basic embed format looks like this:

<EMBED SRC="filename.???"></EMBED>

Just that will do it. If you put a sound file name in where I have "filename.???", you'll get the sound to play if the user has the plug-in to play the file type. Now, some of you might be concerned that the embed command doesn't work in Internet Explorer. Well, when I did my video embed...it worked. Go figure. But just to be safe, you may want to add the command <BGSOUND="filename.???"> just to be on the safe side.

Inside the main EMBED command, you have the ability to place a bunch of different attributes or sub-commands. They are as follows:

HEIGHT="--" and WIDTH="--" This sets the height and width of the space in which the embedded item will play. With a sound, this mattered little. You could have set it to 1X1 and you'd have still heard the sound. Now we're dealing with video and it matters.

LOOP="--" This states if the video will play again and again ("true") or if it should play once and stop ("false" or no use of the LOOP command.)

HIDDEN="--" This will work to hide the control panel. The problem is in this case it also hides the video. That's not good. Don't use it.

AUTOSTART="--" This tells the browser to start the video right away ("true") upon its download completion or to wait for viewer clicks to start playing ("false" or no use of the command). Funny thing...this command worked in Internet Explorer, but not in Netscape Navigator. No matter what I set it to, Navigator required me to click on the start button. Go figure again.



So Let's See It Fair enough. You've read my boring stories. Now you'll see a video embedded just the way I did it during my presentation.





See The Embed In Action



Welcome back! Nifty, huh? A little window for the embedded video. I didn't do that for show either. It was needed. I'll tell you why.



The Problems I Ran Into Problem One I first just tried putting the embed commands right on the page that was going to display as "index.html". No dice. No matter where I put the EMBED commands, I always got a little gray box exactly the size of the HEIGHT and WIDTH commands in the EMBED. That was where the movie was going to play. This never occurred to me. A video must have space on the page to play in. An embedded sound doesn't. Try it. You can put those commands anywhere on the page. You always get a gray box where ever in the code you place it. Even if the EMBED is above the HEAD commands--gray box in the upper left hand corner.

So I solved the problem by putting the embedded video it its own window. By doing that I didn't mess up the formatting of the main page with a gray box, and you got to see the movie. I'll show you the code in a moment.

Problem Two Size. Videos are huge. The video I took of the guy introducing the page pushed a half meg. That's a three minute download over a 56KPs modem. In Internet terms, that's way too long. It ran great through the presentation because it was coming off of my hard drive. But when I tried to run it from the server, it took forever. I was well past my interest in the home page before it started to play. But since it's in its own window, a user can just surf and the download can continue without stopping the user.

Problem Three That video monolith was slowing my surfing down a great deal. As the video was downloading, I was trying to surf. All of these pages were built for speed, but the video download killed the load time of the next page's images.

Problem Four The viewer's computer might not be configured to run the video. I sent the URL of the page to my father who tried to look. His computer balked and gave him a bunch of messages about not knowing the file type, Internet security, the perils of downloading, and asking him what he should do with the file. Of course he chose to not accept it even though it as from his son. Stopping short of disowning me, he was sure I was trying to put a virus on his computer. You know, as a joke. And we all know how funny those viruses can be--a real laugh riot.

Problem Five Format! Which one to use? The three biggies are AVI, MPEG, and Quicktime (mov). If you're an Internet web-head like me, you've configured your computer to play all three. But many people haven't. If you have to pick, I would suggest AVI (Audio Video Interlaced) as all Windows based machines are already set to play the file format. If a lot of Mac's come around, try the Quicktime or the MPEG. Any way you go, you only get one shot at it and you'll miss the mark a few times.



So What? I Want To Embed A Video! So I haven't talked you out of it yet, eh? I guess maybe I shouldn't try, because even though it's a lot of trouble, when that embedded video worked it was a real thing of beauty.

Take my advice and try embedding a video directly onto the page. You'll see the gray box, and come right back asking how to get that new window to pop up that will contain the video. So I'll just get right into it.

There are really two ways to get that new window to pop up. The first way, and this is not the way I recommend, is to use a window.open style JavaScript that opens the new window and fills it with a totally new HTML page. That totally new page will contain the embed commands. You can learn all about opening a new window like that in the tutorial So, You Want To Open A New Window, Huh?.

I like getting my new window using a JavaScript that includes the embed commands right in the script. If you haven't seen this yet, it's a great trick. It's like loading two pages at once. Here's the code I used to get that video embedded. You can copy and paste it right from here. Put it on your page in between the HEAD commands. Just be sure to change out your video's name with my "4secjoe.avi". Also notice the onLoad command at the very bottom of the paste. That has to go in the BODY command to trigger the JavaScript to fire the new window.

Due to space constraints, some of the document.write lines below broke into two lines. Make a point of getting each on its own line when you paste it to your page.



<SCRIPT LANGUAGE="JavaScript">

function openindex() { OpenWindow=window.open("", "newwin", "height=250,width=250,toolbar=no,scrollbars="+scroll+",menubar=no"); OpenWindow.document.write("<HTML>") OpenWindow.document.write("<TITLE>My Embedded Video</TITLE>") OpenWindow.document.write("<BODY BGCOLOR=000000>") OpenWindow.document.write("<EMBED SRC=4secjoe.avi AUTOSTART=true></EMBED>") OpenWindow.document.write("</HTML>") OpenWindow.document.close() self.name="main" } </SCRIPT>

[Don't copy this] ...and this goes in the BODY Command: [Don't copy this]

onLoad="openindex()"





You'll need to play with the size of the window until you're happy with its framing of the video. And That's That... So now you know how to embed a video. The question is if the perils out-weigh the benefits. Maybe yes, maybe no, but man it looks great if you can get it to work. So go and give it a shot. See what happens. If you find a new twist to embedding a video, let me know. I might include it here for the entire world to read
Back to Menu!