Share via


Global Attributes

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

Global attributes are attributes that provide easy access to certain player elements or objects from anywhere within a skin.

The player global attribute is a reference to the Player object, and is used to access the primary functionality of Windows Media Player. The following example uses player to begin digital media playback.

<BUTTON
  onclick="jscript:player.controls.play();"
/>

The theme global attribute is a reference to the THEME element. This is the proper way to access THEME attributes, rather than by specifying an ID within the THEME element. The following example uses theme to open a new view.

<TEXT 
  value="open" 
  onclick="jscript:theme.openView('newView');"
/>

The view global attribute is a reference to the current VIEW. This can be used instead of the ID specified within the various VIEW elements. The following example uses view to close the current view.

<BUTTON 
  id="quitbutton"
  onclick="jscript:view.close();"
/>

The event global attribute is used to access ambient event attributes from within event handlers. The following example uses event to determine whether the ALT key is pressed when a button is clicked.

<BUTTON
  onclick="jscript:if (event.altKey == true) myText.value='ALT';"
/>

The playerApplication global attribute is a reference to the PlayerApplication object, and is used by skin files provided as custom user interfaces for remoted Player controls. The Player control can be embedded in remote mode only in C++ programs that implement the IWMPRemoteMediaServices interface. The following example uses playerApplication to switch to the full mode of the Player.

<BUTTON
  onclick="jscript:playerApplication.switchToPlayerApplication();"
/>

For more information, see Ambient Event Attributes.

Miscellaneous