Windows Media : Simple Buttons

Description: Goal- Incorporate simple buttons in a Web page that allow you to stop, play, and pause the Windows Media Player in both Microsoft Internet Explorer and Netscape Navigator. This sample des

ITPro Today

February 18, 2002

2 Min Read
ITPro Today logo in a gray background | ITPro Today

Description: Goal- Incorporate simple buttons in a Web page that allow you to stop, play, and pause the Windows Media Player in both Microsoft Internet Explorer and Netscape Navigator. This sample describes how to incorporate simple buttons for the Windows Media Player into a Web page. These buttons will work in any browser that supports the Windows Media Player Plug-in and JavaScript.

By adding custom buttons that control the Windows Media, you (as the Web page author) are allowed more control over the look and feel of the page.

The Windows Media Player supports over 20 methods. We'll use the three most common here -- Play(), Pause(), and Stop().

Code to Include

We'll start with our generic cross-browser code 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:

You'll notice that we're using two properties of the Media Player control here, ShowControls and ShowStatusBar. By setting ShowControls to "false," we're hiding the default Media Player Control bar. By setting ShowStatusBar to "true," we're explicitly showing the Media Player Status bar in order to give the user some feedback as to what the Media Player is doing. Next, we'll define a form and some buttons: In the code above, all of the buttons make calls through JavaScript directly to the Media Player using the Document Object Model(DOM). Browser/Platform CompatibilityThis code will work with Internet Explorer 4+, and Netscape Navigator 4+ on platforms that support the Windows Media Player plug-in and ActiveX control.

Complete Article

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like