Updated December 21, 1998
Use the code below to create Web pages that can play embedded streaming media files in the Windows Media Player in both Internet Explorer and Netscape Navigator. This code will embed the Windows Media Player within your Web page, using an ActiveX control for Internet Explorer and a plug-in for Netscape Navigator.
Add the code below to your Web page between the <BODY> and </BODY> tags. Replace "your-file.asx" with the path of a file on your local hard drive or a file on a Windows NT Server running Windows Media Services.
<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/path/your-file.asx"> <PARAM NAME="AnimationatStart" VALUE="true"> <PARAM NAME="TransparentatStart" VALUE="true"> <PARAM NAME="AutoStart" VALUE="true"> <PARAM NAME="ShowControls" VALUE="1"> <Embed TYPE="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows95/downloads/contents/wurecommended /s_wufeatured/mediaplayer/default.asp" SRC="http://server/path/your-file.asx" Name=MediaPlayer ShowControls=1 Width=360 Height=180 > </embed> </OBJECT> <BR><BR> <a HREF="http://servername/path/your-file.asx"> Start the streaming media presentation in the stand-alone player.</a>
Add the following JavaScript code after the </TITLE> tag. This will refresh the Netscape Navigator plug-in and load the MAYSCRIPT applet, which monitors the plug-in for scripting events.
<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>
Back to the Advanced Scripting for Cross-Browser Functionality page
See the related article, "Embed the Windows Media Player and Escape the Box."