Media.attributeCount
[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 attributeCount property retrieves the number of attributes that can be queried and/or set for the media item.
Syntax
player.currentMedia.attributeCount
Possible Values
This property is a read-only Number (long).
Remarks
To retrieve the value of this property, 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.attributeCount to determine the number of attributes available in the current media item. The code uses that value to print a list of attribute names and values in an HTML text area, named myText. The Player object was created with ID = "Player".
// Store the current media object.
var cm = Player.currentMedia;
// Create arrays to hold each attribute name and value.
var atNames = new Array();
var atValues = new Array();
// Loop through the attribute list.
for(var i = 0; i < cm.attributeCount; i++){
// Fill the arrays with the attribute info.
atNames[i] = cm.getAttributeName(i);
atValues[i] = cm.getItemInfo(atNames[i]);
// Print the attribute information to the text area.
myText.value += atNames[i] + ": " + atValues[i];
myText.value += "\n";
}
Requirements
Requirement | Value |
---|---|
Version |
Windows Media Player version 7.0 or later. |
DLL |
|