Compartilhar via


Media.getAttributeName method

[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.]

The getAttributeName method retrieves the name of the attribute corresponding to the specified index.

Syntax

strRetVal = Media.getAttributeName(
  index
)

Parameters

index [in]

Number (long) containing the index of the attribute.

Return value

This method returns a String specifying the name of the attribute.

Remarks

The attribute name returned can be used in conjunction with getItemInfo to retrieve the value for a specific named attribute.

To use this method, read access to the library is required. For more information, see Library Access.

For information about the attributes supported by Windows Media Player, see the Windows Media Player Attribute Reference..

Windows Media Player 10 Mobile: Attributes for a media item are available only during playback unless they are retrieved from the item through the media collection.

Examples

The following JScript example uses Media.getAttributeName to fill an HTML text area named myText with the index and name of each attribute for the current media item. The Player object was created with ID = "Player".

// Store the current media object.
var cm = Player.currentMedia;

// Get the number of attributes for the current media. 
var atCount = cm.attributeCount;

// Loop through the attribute list.
for(var i=0; i < atCount; i++){
   
   // Print each attribute index and name.   
   myText.value += "Attribute " + i +": ";
   myText.value += cm.getAttributeName(i);
   myText.value += "\n";
}

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

Media Object

Media.attributeCount

Media.getItemInfo

Settings.mediaAccessRights

Settings.requestMediaAccessRights