-->
Save your seat for Streaming Media NYC this May. Register Now!

The Windows Media ActiveX Control – Not Just for Internet Explorer Anymore

Embedding the Windows Media Player in Your Web Page
Embedding the control for Mozilla works the same way as with the Internet Explorer:

<object id="MyWMPlayer" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" height="340" width="320"> <param name="uiMode" value="full"> <param name="autoStart" value="true"> <param name="URL" value="testfile.asx"> </object>The classid attribute of the object tag will load either Windows Media Player 7 or 9, whichever is installed on the local computer. Mozilla ignores the codebase attribute, which for Internet Explorer with WMP 6.4, would start an automatic download of the control if it's not present on the system.

Using JavaScript with the Player
The Windows Media Player 7/9 has a rich set of control functions that can be called from Javascript in the Web page. Calling these from Javascript is the same whether you're in Mozilla or Internet Explorer. Here's an example of a function that will start playback of the ActiveX control in the previous example:

function startPlayback(){ document.MyWMPlayer.controls.play(); }There's a variety of methods you can call on the WMP control, detailed in the WM9 Player SDK available at Microsoft's WM SDK Download site. A great working sample of this code can be found at Netscape's DevEdge Embedded Player Sample.

Streaming Covers
Free
for qualified subscribers
Subscribe Now Current Issue Past Issues