Sams Teach Yourself HTML 4 in 24 Hours

Sams Teach Yourself HTML 4 in 24 Hours

By Dick Oliver

Embedding Video in a Web Page

The HTML page in Figure 17.3 demonstrates the use of <embed /> with a video clip in the Windows AVI (Audio-Video Interleave) format. The <embed /> tag in Figure 17.3 also includes the autostart and loop attributes, which tell Netscape's LiveVideo plug-in to start playing the video when the page loads and to repeat it as long as the page is being displayed. Figure 17.4 shows the resulting page as viewed with Netscape Navigator 4.

17fig03.gif

Figure 17.3 You can embed a video into a Web page with the same <embed /> tag used to embed sound.

17fig04.gif

Figure 17.4 This is the page in Figure 17.3 as seen in Netscape Navigator 4. If this page were a computer screen, the fractal would be spinning and a soundtrack would be playing.

Microsoft Internet Explorer will recognize the <embed /> tag and try to find an OLE-compliant Windows application to display the media file. In the case of AVI video, the Windows Media Player application will usually be embedded into the Web page, as shown in Figure 17.5.

17fig05.gif

Figure 17.5 This is the page in Figure 17.3 as seen in Microsoft Internet Explorer 5. The Windows Media Player is automatically embedded in the Web page.

Notice that the size of the video is reduced to make room for the Media Player controls. This isn't ideal, since it makes the video appear differently in Internet Explorer than it does in Netscape Navigator. In the next section of this hour you learn how to remedy this problem.

When Navigator and Explorer encounter an <embed /> tag, they basically try their hardest to find some way to embed the media file directly in the Web page. As a Web page author, you can't predict what plug-in or helper application will be selected, but you can at least try to put some instructions on the Web page telling your audience from where to download a suitable player.

You can use <embed /> with any type of audio, video, or interactive multimedia files as long as your audience has the correct player software installed.

Unfortunately, you as a Web page author have no control over or knowledge of which file types and applications people who visit your pages will have configured on their computers, or even how many visitors will be using a Microsoft Windows operating system. So the exotic uses of <embed /> are probably best left to corporate intranets or other situations where the page publisher has some control over the intended audience's computer setup.

Share ThisShare This

Informit Network