Media.attributeCount

[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 如果可能,Microsoft 强烈建议新代码使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]

attributeCount 属性检索可为媒体项查询和/或设置的属性数。

语法

玩家currentMediaattributeCount

可能的值

此属性是只读 Number () 。

备注

若要检索此属性的值,需要对库的读取访问权限。 有关详细信息,请参阅 库访问

有关 Windows 媒体播放器 支持的属性的信息,请参阅 Windows 媒体播放器 属性参考

Windows 媒体播放器 10 移动版:媒体项的属性仅在播放期间可用,除非通过媒体集合从该项检索它们。

示例

以下 JScript 示例使用 媒体attributeCount ,用于确定当前媒体项中可用的属性数。 代码使用该值在名为 myText 的 HTML 文本区域中打印属性名称和值的列表。 创建的 Player 对象 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";
}

要求

要求
版本
Windows 媒体播放器版本 7.0 或更高版本。
DLL
Wmp.dll

另请参阅

媒体对象

Media.getAttributeName

Media.getItemInfo

Settings.mediaAccessRights

Settings.requestMediaAccessRights