Introducing Multimedia Objects - HTML

Depending on the browser with which your users view your Web pages, multimedia can offer either a very rewarding or a very frustrating experience for your users. For example, if your users are using Netscape 3 to view a multimedia page, chances are they’ll be taking a long journey that they’ll ultimately cancel. This journey will consist of numerous dialog boxes and visits to Web pages for downloading plug-ins, which are small extensions to browsers used to extend a browser’s capabilities.

These downloads are necessary when a browser first encounters a multimedia object, because browsers don’t have native support for such multimedia as Flash, RealAudio (now known as RealOne), and so on.

In fact, you might be surprised to find out that browsers on today’s market generally don’t provide native support for the near ubiquitous Flash plug-in (Opera is the lone exception, but it’s usually a version or so behind the latest Flash players). Instead, the plug-in for Flash needs to be installed. However, Macromedia, the developer of Flash, has made the installation process so painless that Macromedia claims that Flash is now in more than 97% of all browsers.

Those figures may be inflated by Macromedia’s PR machine, but there is little question that the installed base is huge. You can be assured, however, that of those who don’t have the plug-ins installed, many of them have older browsers such as Netscape 3.

The reason for the difference is that modern browsers make plug-in installation a snap, whereas older versions required multiple visits to different sites and often numerous forms. Frankly, the best way to handle users with antiquated browsers is to simply bypass their multimedia options altogether, because their use of such an ancient browser is an indication that they don’t care very much about the newest technology anyway. This can be done using browser-sniffing scripts.

Cross- Reference
Browser sniffing, or browser detection, is a JavaScript-based process for detecting what kind of browser a user is using to view Web pages and displaying content based on the results of these findings. Chapter explains how to develop these scripts.

You can use a browser-sniffing script to send users with older browsers to HTML-only pages or write messages to their browser windows telling them they have crummy browsers (in a nice way, of course).

Keep in mind that professional-looking multimedia requires a substantial investment in either your time or money (which you’ll spend to get a professional to put it together for you). A long time ago, HTML purists cringed when they saw the notorious <blink> tag. Today, many Web site visitors’ first reaction upon seeing Flash intros is to hunt for the “Skip Intro” button on these presentations. When making a decision about whether to use a multimedia object, ask yourself the following questions:

  • Does the multimedia object actually offer something I can’t otherwise accomplish with HTML?
  • Does it truly enhance my Web site?
  • Will my users’ browsers support the multimedia object I’m using?
  • Do I have the resources to make a genuinely professional multimedia presentation?

If you can answer these questions in the affirmative, you’re ready to go.

Your multimedia options

There are four general categories of multimedia objects:

  • Video clips—are supported by such applications as RealOne Player, the Windows Media Player, or Apple’s QuickTime. Generally, when a file relying on one of these programs is accessed, the multimedia doesn’t appear within the browser window (although it can). Instead, it spawns a window of the player application that plays the media.
  • Animationscan be generated by bit-map-based (paint) applications, such as Fireworks and Photoshop. These kinds of programs create GIF files consisting of several frames to produce an animation. Maybe you remember seeing a stack of papers in elementary school with a series of pictures, and as you flip through the stack, the image changed ever so slightly, creating an animated effect. The process is similar with animated GIFs. You see them everywhere these days, especially in banner ads. Most people consider them annoying, so use them with care and caution.
  • Soundscan come in many formats, but again, you want to use them judiciously, because you can turn off your Web site visitors with them and even get them into trouble if they’re visiting your Web page from the work place.
  • Slide shows—are surprisingly useful for Web sites and can be created quite easily using PowerPoint or a free slide creation tool such as the presentation creation tool in OpenOffice.org’s office suite.

What about Java applets?

Java applets, although not as common as they once were, are still used occasionally by some developers. The problem with Java applets is that they rely on a Java Virtual Machine installation that has proven to result in terrible inconsistencies across platforms. The only way around this is to hire an army of programmers to produce rock solid browser-sniffing scripts. One example of a reasonably successful deployment of Java-based applets was ESPN’s GameCast, but even that has moved over to Flash.

Including multimedia in your Web pages
One kind of multimedia requires no plug-ins at all and can be written directly in your HTML. This is the animated GIF, which can simply be included in an img element, like so:

<img src=“myAnimation.gif” width=“468” height=“60”>

As long as the animated GIF actually animates, you’re in business. Most other multimedia requires the use of a plug-in, although you could consider some Dynamic HTML and CSS to be multimedia; and certainly, especially with some of the transition effects available in Internet Explorer through the use of both scripting and Microsoft’s proprietary extensions to CSS, multimedia effects can be accomplished this way.

Cross- Reference
The standard way of embedding a multimedia object using HTML 4.0 is through the use of the object element.
Cross- Reference

Cross- Reference

You can also use child param elements within an object element to pass parameters to the multimedia object. These parameters are generally like little bits of helpful information that help fine-tune exactly how you want the object to behave. You can use to review the param element’s attributes.

Attributes of the param element
The following example shows a Flash file embedded in an HTML document:

The key to using the param elements is that the multimedia object must understand what the parameters mean. So, you need to either have access to some documentation about how the multimedia object works and what kind of parameters it expects, or you need to get your hands on a tool that generates the HTML for you. In the case of Flash, its movie exporting facilities take care of this for you.

Embedding a Flash File Using an Object Element

Note the use of the deprecated embed element as a child element of the object element. The embed element is still needed for Netscape 4 and some other browsers, however, so use it if you’re looking for cross-browser functionality. Keep in mind the following about the embed element:

Do not include a name attribute with the object element when using the embed element, especially if it is the same name value as that of the embed element because it could cause confusion when scripting.

Parameters are handled through the use of custom attributes. Notice, for example, the allowScriptAccess=“sameDomain” attribute/value pair. The allowScriptAccess attribute is not actually part of the embed element. Instead, it’s a special attribute that Flash understands. These custom attributes have the same functionality as the object element’s param element children. Different plug-in vendors may require different configuration parameters.

The pluginspage attribute is an attribute of the embed element. It manages the way in which a plug-in is obtained if it isn’t installed in the browser. This attribute points to a page to get the plug-in if the plug-in is not detected by the browser.

How the Eolas Lawsuit Will Affect You
As this book was being written, Microsoft was trying to deal with losing a $521 million patent infringement lawsuit filed by Eolas, a company founded by Michael Doyle, former director of the University of California academic computing center.

The patent governs the use of any object included in a Web page using the embed, object, or applet elements. Although Microsoft has appealed the decision, future versions of Internet Explorer (beyond version 6) will present a pop-up window asking users if they wish to view an embedded application or media file.

This does not affect objects that use no param elements. There are some workarounds. One, obviously, is to not include any param elements. That pretty much wipes out any hope of using Flash. Another is to embed the applications using script.

The following example shows how to create a Web page that uses DHTML to load a Microsoft Windows Media R_ Player control.

<HTML><HEAD><SCRIPT SRC=“sample.js”></SCRIPT></HEAD><BODY><SCRIPT> ReplaceContent();</SCRIPT></BODY></HTML>

An ActiveX control can be inserted into a Web page by setting the innerHTML or outer- HTML property of an existing element, or by calling document.write (which is the healthier, cross-browser method). The following script creates the Windows Media Player using document.write:

function ReplaceContent(){ document.write(‘<OBJECT CLASSID=“CLSID:6BF52A52-394A-11d3- B153-00C04F79FAA6”>’); document.write(’<PARAM NAME=“URL"); document.write(‘samples/author/dhtml/media/drums.wav”/></OBJECT>’); }

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

HTML Topics