Sams Teach Yourself HTML 4 in 24 Hours

Sams Teach Yourself HTML 4 in 24 Hours

By Dick Oliver

Using ActiveX to Embed a Video

ActiveX controls can do anything a programmer can cook up, but there is one specific ActiveX control included with Microsoft Internet Explorer that you should definitely know how to use. The ActiveMovie control is the Microsoft equivalent of Netscape's LiveVideo plug-in. Using ActiveMovie is currently the most reliable way to play a video in Microsoft Internet Explorer without displaying the clunky controls you get when the Windows Media player is embedded in a Web page.

Figure 18.5 shows the classid and <param /> options you need to know to use the ActiveMovie control. (The parameters are pretty self-explanatory, as long as you know that "1" means yes/on and "O" means no/off.) Take a look at Figure 18.6. This ActiveX object creates exactly the same effect in Microsoft Internet Explorer 4 and 5 as the <embed /> example from Hour 17 creates for Netscape Navigator 4.

18fig05.gif

Figure 18.5 You can use the ActiveMovie control to play a video with the <object> tag shown here.

18fig06.gif

Figure 18.6 The page listed in Figure 18.5 looks the same in both Netscape Navigator and Microsoft Internet Explorer.

Notice that I included the Netscape <embed /> tag between the <object> and </object> tags in Figure 18.5. If an <object> tag is successful in embedding the object it refers to (in this case, the ActiveMovie control), it will ignore all the HTML up to its closing </object> tag (except any <param /> tags). However, if the requested object can't be found or displayed for any reason, the rest of the HTML in front of the closing </object> tag is not ignored. In this case, that means that if the <object> tag doesn't work (probably because someone isn't using Microsoft Internet Explorer as his or her browser), the <embed /> tag will be called on instead. Therefore, the page will work nicely in both Microsoft Internet Explorer and Netscape Navigator.

As a last resort, an image linked to the video is included between <noembed> and </noembed> tags. This won't be seen by any recent version of Microsoft Internet Explorer or Netscape Navigator; it's just there for other Web browsers that don't support either ActiveX or embedded multimedia.

Share ThisShare This

Informit Network