Share via


MediaCollection Object

[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 MediaCollection object provides a way to organize a large collection of media items. It can be queried to generate playlists automatically.

The MediaCollection object supports the following methods.

Method Description
add Adds a new media item or playlist to the library.
createQuery Creates a new Query object.
getAll Retrieves a Playlist object containing all media items in the library.
getAttributeStringCollection Retrieves a StringCollection object representing the set of all values for a specified attribute within a specified media type.
getByAlbum Retrieves a Playlist object containing media items from the specified album.
getByAttribute Retrieves a Playlist object containing media items with the specified attribute having the specified value.
getByAttributeAndMediaType Retrieves a Playlist object containing Media objects having the specified attribute and media type.
getByAuthor Retrieves a Playlist object containing media items by the specified author.
getByGenre Retrieves a Playlist object containing media items with the specified genre.
getByName Retrieves a Playlist object containing media items with the specified name.
getMediaAtom Retrieves the index at which a specified property resides within the set of available properties.
getPlaylistByQuery Retrieves a Playlist object containing Media objects that match the query conditions.
getStringCollectionByQuery Retrieves a StringCollection object containing strings that match the query conditions.
isDeleted Retrieves a value indicating whether the specified media item is in the deleted items folder.
remove Removes an item from the media collection.
setDeleted Moves the specified media item to the deleted items folder.

 

The MediaCollection object is accessed through the following property.

Object Property
Player mediaCollection

 

See also

Object Model Reference for Scripting