Web Coding & Development All-in-One For Dummies
Book image
Explore Book Buy On Amazon

If you are creating your Web page in an HTML editor, such as Notepad, you can include video for your Web site visitors. The easiest way to add video to your Web page, is to offer a link to a video you have stored on YouTube, which offers free hosting for videos that you upload. This saves you from having to compress the video, worry about performance of the server, and pay for the megabytes downloaded.

Almost every video on YouTube includes a box with the code you paste into your Web page to play the video there, surrounded by your own content. This code is customized for playback in Flash, a specialized media playback tool:

<object width="425" height="344"><param name="movie" 
value="http://www.youtube.com/v/HhcLUF59Oh4&hl=en&fs=1"></param>
<param name="allowFullScreen" value="true"></param>
<embed src="http://www.youtube.com/v/HhcLUF59Oh4&hl=en&fs=1" 
type="application/x-shockwave-flash" allowfullscreen="true" 
width="425" height="344"></embed></object>

Flash was originally used mostly for animations but is increasingly used as a container for video and audio.

Open your Web page in Notepad and follow these steps to include a video in your Web page, no matter where it’s hosted.

  1. Specify the path and filename of the video you want to use.

    If your video is hosted somewhere other than YouTube, type in the following, using the actual path and filename: =“pathname/filename”>.

    If the video is hosted on YouTube, go to the relevant YouTube page and copy the code for the video from there. Paste it into your Web page.

    If the video is in the same folder as your Web page, the pathname is just the filename; if the video is on the Web, the pathname is the URL of the video.

    If the file is in a different folder on your machine than the Web page, include the path to the video.

  2. Specify the size of the video using the tag:

    It should look like this:

            <object width="xxx" height= "yyy">

    The tag tells the user’s Web browser that there is something in the Web page, at this spot, of the size you specify. The width and height attributes do roughly the same thing. Specifying the size in both ways, as YouTube does, is a way to make sure that the Web browser sets aside space for the video when it first displays the Web page.

  3. Save the file and open it in a Web browser. Try the video.

    If you you’re having trouble successfully including video in your Web page, or if you’re worried about download charges, then upload the video to YouTube or another host. On your Web page, you can provide a “normal” link to the Web page that hosts the video. Users can click the link to see it and then return to your site after they’ve viewed it.

About This Article

This article can be found in the category: