MediaCollection.getAttributeStringCollection 方法
getAttributeStringCollection 方法检索一个 StringCollection 对象,该对象代表指定媒体类型中指定属性的所有值集。
语法
retVal = MediaCollection.getAttributeStringCollection(
attribute,
mediaType
)
参数
-
属性 [in]
-
指定特性的字符串。
-
mediaType [in]
-
表示媒体类型的字符串。 包含以下值之一:“Audio”、“Video”、“Playlist”或“Other”。
返回值
此方法返回 StringCollection 对象。
注解
若要使用此方法,需要对库进行读取访问权限。 有关详细信息,请参阅 库访问。
有关Windows 媒体播放器支持的属性的信息,请参阅“属性参考”部分。
示例
以下JScript示例使用 MediaCollection。getAttributeStringCollection 以显示与媒体集合中音频项的特定属性对应的值列表。 使用 ID = “Attribute”创建的 HTML SELECT 元素允许用户选择一个属性,例如艺术家、流派或专辑。 使用 ID = “AttributeVals” 创建的 HTML TEXTAREA 元素将显示结果。 玩家对象是使用 ID = “ Player ” 创建的。
// Clear the text in the display area.
AttributeVals.value = "";
// Store the mediaCollection object.
var library = Player.mediaCollection;
// Get the string collection for the attribute type the user selects.
var all = library.getAttributeStringCollection(Attribute.value, "Audio");
// Loop through the string collection.
for (i = 0; i < all.count; i++){
// Display the items one line at a time.
AttributeVals.value += all.item(i);
AttributeVals.value += "\n";
}
要求
要求 | 值 |
---|---|
版本 |
Windows 媒体播放器 7.0 或更高版本。 |
DLL |
|