Windows Media Player SDK banner art
PreviousNext

Accessing Properties

This topic applies to Windows Media Player version 6.4 only.

Accessing and modifying the properties of the Windows Media Player control requires somewhat different scripting syntax for Netscape Navigator and Microsoft® Internet Explorer. For example, to retrieve and set the FileName property from Netscape Navigator, use the following:

MediaPlayer.SetFileName("demo.asf");
var myTitle = MediaPlayer.GetFileName();

The corresponding statements in Internet Explorer are as follows:

MediaPlayer.FileName = "demo.asf"
var myTitle = MediaPlayer.FileName

To write a script that works under both browsers, check the browser type before accessing the properties. The following code segment shows how to toggle the mute setting for either Netscape Navigator or Internet Explorer.

function mute() {
    if (navigator.appName=="Netscape") {
        if (document.MediaPlayer.GetMute()=="0") {
            document.MediaPlayer.SetMute(1);
        } else if (document.MediaPlayerGetMute()=="1") {
            document.MediaPlayer.SetMute(0);
        }
    } else {
        if (document.MediaPlayer.Mute==0) {
            document.MediaPlayer.Mute = 1;
        } else if (document.MediaPlayer.Mute==1) {
            document.MediaPlayer.Mute = 0;
        }
    }
}
PreviousNext


© 2000-2001 Microsoft Corporation. All rights reserved.