A Streaming Media JukeBox: Embedding the Windows Media Player | WebReference

A Streaming Media JukeBox: Embedding the Windows Media Player

A Streaming Media JukeBox

Embedding the Windows Media Player

There are two ways to play a streaming media file. The first one is through an external Media Player. If you haven't install it yet on your computer, this link will connect you immediately to the download area:

Get Windows Media Player

To invoke the external Media Player, just place a link to an asf or ASX file in your Web page. To see a live demo of a streaming media, try this story about a turtle. The minimum modem baud rate should be 28.8K. The video stream will look more like still pictures with lower-rate communication link.

The second method to play a streaming media is to embed the Media Player in the Web page. The way to do it is by embedding an ActiveX control. As the subject of ActiveX controls needs much more attention than we can give it here, we won't dive into it in this column (we will dedicate a column to it in the near future). For now, it is sufficient to view ActiveX controls as objects that we embed in Web pages. Each object type supports a set of properties, methods, and events that is relevant to its role on the page. It is not a coincident that the HTML tag that embeds ActiveX controls is the <OBJECT> tag. Here is how the Media Player ActiveX control looks like:

  // (The above two lines should be joined as one line.
  // They have been split for formatting purposes.)
  STANDBY="Loading Microsoft Windows Media Player components..."
  <PARAM NAME="fileName" VALUE="http://msdn.microsoft.com/
  // (The above three lines should be joined as one line.
  // They have been split for formatting purposes.)
  <PARAM NAME="animationatStart" VALUE="true">
  <PARAM NAME="transparentatStart" VALUE="true">
  <PARAM NAME="autoStart" VALUE="true">
  <PARAM NAME="showControls" VALUE="true">

Let's examine the components of this tag:

IDObject ID. Can be assigned any string constant.
CLASSIDMedia Player ActiveX control registration number. Must be copied and pasted as is.
CODEBASEURL of the decompression application. Must be copied and pasted as is.
STANDBYA message to be displayed while loading the Media Player.
TYPEActiveX control type specification. Must be copied and pasted as is.

The <OBJECT> tag is accompanied with several parameter specifications:

fileNameStringURL of the ASF or ASX file. Can reside on an HTTP server (http://), MultiMedia Server (mms://), local hard drive (u:), or on a network drive (p://).
animationAtStartBooleanSpecifies whether to activate the Microsoft animation show while the ASF or ASX file buffers. Default is true; ignored if transparentAtStart is true.
autoStartBooleanSpecifies whether to start the ASF file when the page loads.
showControlsIntegerSpecifies whether to show the player's control buttons. A value of true shows the controls, while a value of false means no controls.
clickToPlayBooleanSpecifies whether to start the ASF when the user clicks on the player's display area.
transparentAtStartBooleanSpecifies whether to make the player transparent at the start of the play. Default is false. Takes precedence over animationAtStart.


Produced by Yehuda Shiran and Tomer Shiran

Created: October 25, 1999
Revised: November 20, 1999

URL: http://www.webreference.com/js/column51/install.html