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 要素が結果を表示します。 Player オブジェクトは 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";
}
必要条件
要件 | 値 |
---|---|
Version |
バージョン 7.0 以降Windows メディア プレーヤー。 |
[DLL] |
|