Click to return to the Windows Media Technologies home page    
Web Workshop  |  Streaming & Interactive Media  |  Windows Media Technologies

Embedding Content Within a Web Page with the <OBJECT> Tag


Updated February 10, 1999

To embed ASF content into a Web page only to be played by clients running Microsoft Internet Explorer, just insert the following code into your HTML file:

<OBJECT ID="MediaPlayer"  classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
 CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en
    /nsmp2inf.cab#Version=5,1,52,701"
 standby="Loading Microsoft Windows Media Player components..."
 TYPE="application/x-oleobject">

<PARAM NAME="FileName" VALUE="mms://server/asxfile">
</OBJECT>

<!--HAVE USERS WITH BROWSERS THAT CANNOT EMBED PLAY IN WINDOWS MEDIA PLAYER-->
<a HREF="http://server/path/myvideo.asx">Start the Windows Media Services
presentation in the stand-alone player.</a>

In the code above, be sure to substitute the actual width and height of the ASF file for the WIDTH and HEIGHT, and substitute your actual ASX or ASF file location for the value in the FileName parameter.

There are many ways you can customize the way the Windows Media Player content plays when embedded using the Windows Media Technologies (WMT) <OBJECT> tag. For a complete list of the events, methods, and properties supported by WMT, see the Windows Media Services SDKNon-MSDN Online link. Here are some examples of parameters you can add to the WMT <OBJECT> tag to customize playback:

Function Parameter for Windows Media Services <OBJECT> Tag
No controls <PARAM NAME="ShowControls" VALUE="FALSE">
Display controls <PARAM NAME="ShowControls" VALUE="TRUE">
Start ASF when page loads <PARAM NAME="AutoStart" VALUE="TRUE">
Start ASF when user clicks on it <PARAM NAME="ClickToPlay" VALUE="TRUE">
Stop the Windows Media Services animation at the beginning of the ASF <PARAM NAME="TransparentAtStart" VALUE="TRUE">

The Windows Media Player automatically installs a Netscape plug-in. To use that plug-in to embed the ASF content into the page, just put the following code into the HTML:

<Embed TYPE="application/x-mplayer2"
pluginspage=
  "http://www.microsoft.com/windows95/downloads/contents/wurecommended/s_wufeatured/mediaplayer/default.asp"
   SRC="http://server/file.asx"
   Name=MediaPlayer
   ShowControls=1
   ShowDisplay=1
   ShowStatusBar=1
>
</embed>

<!--HAVE USERS WITH BROWSERS THAT CANNOT EMBED PLAY IN WINDOWS MEDIA PLAYER-->
<a HREF="http://server/path/myvideo.asx">Start the Windows Media Technologies
presentation in the stand-alone player.</a>

In the code above, be sure to substitute the actual ASX or ASF locations and the actual width and height.

Here's an example <OBJECT> tag that includes the WMT control, the Netscape plug-in, and some parameters to customize playback:

<OBJECT ID="MediaPlayer"  classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
 CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
 standby="Loading Microsoft Windows Media Player components..."
 TYPE="application/x-oleobject">

<PARAM NAME="FileName" VALUE="http://server/file.asx">
<PARAM NAME="AnimationatStart" VALUE="true">
<PARAM NAME="TransparentatStart" VALUE="true">
<PARAM NAME="ControlType" VALUE="2">
<PARAM NAME="AutoStart" VALUE="true">


     <Embed TYPE="application/x-mplayer2"
          pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"
          SRC="http://server/file.asx"
          Name=MediaPlayer
          ShowControls=1
          ShowDisplay=1
          ShowStatusBar=1
     >
     </embed>
</OBJECT>

<!--HAVE USERS WITH BROWSERS THAT CANNOT EMBED PLAY IN WINDOWS MEDIA PLAYER-->
<a HREF="http://server/path/myvideo.asx">Start the WMT
presentation in the stand-alone player.</a>

Additional scripting information and code samples are available in the MSDN Online Downloads area (see Windows Media Technologies in the Table of Contents).



Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.