Streaming Magazine Column - April 2003
Table of Contents
Chapter Excerpt
Updates
Order the Book
Resources
Tips & Tricks
Streaming Magazine
  Column
Feedback
Author
Home

Getting Fancy, Part I

There are times when you may want to embed your streaming media presentation in your web page instead of launching a "pop-up" player. Embedding your player gives you the ability to customize the look and feel of your presentation, since you can design the area surrounding the embedded presentation just as you would any other web page.

Embedded players can be problematic, however, because there are cross-platform and cross-browser compatibility issues. To understand these, it's necessary to understand the underlying architecture that enables embedded streaming media players.

Netscape Plug-In vs. ActiveX control

There are two different methods to embed a streaming media player within the browser. You can use either the Netscape plug-in or the Microsoft ActiveX control. Netscape plug-ins uses the <embed> tag, while Microsoft ActiveX controls use the <object> tag. The problem is browsers use either one method or the other, so browsers that use the Netscape plug-in can't use ActiveX controls and vice-versa (Netscape, Opera, Mozilla, Safari, and Konqueror all use the Netscape plug-in architecture, as does IE on the Mac). The good news is that there's a workaround - sort of.

Browsers ignore tags that they don't understand, so you can use both the Netscape plug-in and the ActiveX control, thereby supporting both architectures. Here's how it works. The ActiveX code for the QuickTime player looks like this:

<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
	width="160" height="136" 
	codebase="http://www.apple.com/qtactivex/qtplugin.cab">
	<param name="src" value="YourRefMovie.mov">
</object>

The Netscape plug-in code to embed the same presentation looks like this:

<embed src="YourRefMovie.mov" width="160" height="136" 
	pluginspage="http://www.apple.com/quicktime/download/">
</embed>

If you take a close look, the syntax is different but they're essentially specifying the same information. The ActiveX control uses the classid parameter to specify the QuickTime plug-in, width and height parameters to specify the size of the video display window, the codebase parameter to specify where the ActiveX control can be found if the user doesn't already have it installed, and a name-value pair "src" and "YourRefMovie.mov" to specify the file to be streamed.

The Netscape plug-in specifies essentially the same information, but without the classid parameter. Instead the Netscape plug-in uses the MIME type of the source file to determine what plug-in to use.

It turns out that the code for both can be combined so that both browsers can render it correctly, by placing the <embed> tag within the <object> tag as follows:

<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
	width="160" height="136" 
	codebase="http://www.apple.com/qtactivex/qtplugin.cab">
	<param name="src" value="YourRefMovie.mov">
	<embed src="YourRefMovie.mov" width="160" height="136" 
		pluginspage="http://www.apple.com/quicktime/download/">
	</embed>
</object>

What happens is IE ignores the <embed> tag, while Netscape ignores the <object> and tags. Each browser interprets the tags it understands, and ignores the tags it doesn't recognize. The result is a QuickTime player embedded in your web page, viewable by just about anyone.

Not Quite

So all you have to do is include the code for the Netscape plug-in and the ActiveX control and you're done, right? For QuickTime and RealNetworks, yes, but it gets tricky if you're working with Windows Media and wish to support Mac users and/or Netscape-based browsers. Here's the deal:
  • Windows Media stopped offering support for the Netscape plug-in with the 7.0 player. However, you can still embed a Windows Media 6.4 player.
  • Netscape changed the plug-in model in their newer browsers, so the Windows Media 6.4 plug-in doesn't work on browsers newer than Netscape 6.0.
  • Windows Media 9 Series now provides a Java Applet to serve as an intermediary between Netscape browsers and the ActiveX - but this obviously requires the Windows Media 9 series player.
  • Currently there is no Windows Media 9 Series player available for the Mac.
  • IE on the Mac uses the Netscape Plug-in.
This sets up a somewhat bewildering array of choices, none of which is optimal if you're trying to support every possible user. If true cross-platform, cross-browser support is what you're after, the best solution is to detect the platform and browser using JavaScript, and then use the appropriate code. That's the topic for next month.

Next Month: Authoring - Detecting Platform and Browser Version


Order Now   |    Email   |    Site by Smacktastic/GrDesign   |    All Content ©2002 Streaming Media Bible.com