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

Auto-Installing Windows Media Player Using the Codebase Statement

Updated February 10, 1999

You can add the codebase option to the Windows Media Player <object> tag to automatically check to see if a client has the Windows Media Player installed, and if it is the current version. If the client already has it installed and it is the current version, the content will play. If it is not installed, or it is not the current version, the current version of the player will be installed automatically on the client, and then the content will start playing. Depending on the level of security set on the client's browser, the user may be asked whether it's OK to install this software first.

This JavaScipt code will reload your ActiveX control and help your plug-in play better:

<script language="JavaScript">
<!--
    if ( navigator.appName == "Netscape" )
    {
        navigator.plugins.refresh();
        document.write("\x3C" + "applet MAYSCRIPT Code=NPDS.npDSEvtObsProxy.class" )
        document.writeln(" WIDTH=5 HEIGHT=5 NAME=appObs\x3E \x3C/applet\x3E")
     }
//-->
</script>

Add this code to your Web page between the <BODY> and </BODY> tags:

<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 Windows Media Technologies
presentation in the stand-alone player.</a>

Note that using the codebase option works for Windows® 95 and Windows NT® clients running Microsoft Internet Explorer. It is a good idea to include a link on your page to the Windows Media Player download page at http://www.microsoft.com/windows/mediaplayer/download/default.asp Non-MSDN Online link for users of Netscape Navigator.



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.