Windows Media : Cross-Browser Embedding

Description: Goal- Embed the Windows Media Player in Microsoft Internet Explorer (IE) and Netscape Navigator.This sample shows how to embed the Windows Media player into a Web page for both Intenet Explorer and Netscape Navigator.

More Details

Not only does the Windows Media Player install as both a stand-alone application and as an ActiveX control, but it also installs a Netscape Navigator plug-in. Since Netscape Navigator cannot communicate directly with Microsoft ActiveX controls, Microsoft Windows Media Player includes a plug-in (Npdsplay.dll) to allow Netscape Navigator users to watch ASF content.

Basically, the tag won't work with Netscape, and so we need to use the plug-in embedding architecture (). Luckily, we can write for both architectures in the same section of code.

Code to Include

This is the generic cross-browser embedding code. This code will instantiate the Media Player ActiveX control for browsers which support ActiveX, and the Media Player plug-in for browsers that don't:
<object id="MediaPlayer1" width="160" height="162" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> <param name="FileName" value="http://webserver/path/your-file.asx"> <param name="AutoStart" value="false"> <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="http://webserver/path/your-file.asx" name="MediaPlayer1" width="160" height="162" autostart="false"></embed></object> <br><a href="/article/web-services/turtle28.asx">Open In stand-alone player</a> In the Media Player element, all of the Media Player's properties are handled as attributes. In this example, the AutoStart property is handled as a tag within the tag, and as a simple attribute within the tag. Please note that the only difference between the models is that the tag uses an attribute called SRC. This attribute is equivalent to the FileName parameter. Also, the Media Player plug-in uses a Name attribute instead of an ID attribute. All other properties are named the same across the different models. In this example we're also using the AutoStart property. AutoStart is simply a means of loading the file without setting it to play. When the user actually clicks on the Play button, the content will start. Browser/Platform Compatibility This code will work with Microsoft Internet Explorer 4.0+ and Netscape Navigator 4+ on platforms that support the Windows Media Player plug-in and ActiveX control.

Complete Article

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish