MediaCollection.getByGenre method

The getByGenre method retrieves a playlist of the media items with the specified genre.

Syntax

retVal = MediaCollection.getByGenre(
  genre
)

Parameters

genre [in]

String containing the name of the genre.

Return value

This method returns a Playlist object.

Remarks

To use this method, read access to the library is required. For more information, see Library Access.

Examples

The following JScript example uses MediaCollection.getByGenre to retrieve a playlist of media items. The playlist contains items with the genre specified by the user in an HTML TEXT input element named GetGenre. The Player object was created with ID = "Player".

<!-- Use an HTML BUTTON element to create the playlist and play 
the media items. -->
<INPUT TYPE = "BUTTON"  
       NAME = "PlayGenre"  
       ID = "PlayGenre"  
       VALUE = "Play Genre"

onClick = "
    /* Retrieve the genre text from the user. */
    var genre = GetGenre.value;

    /* Create the playlist using getByGenre. */
    var pl = Player.mediaCollection.getByGenre(genre);

    /* Make the new playlist the current playlist. */
    Player.currentPlaylist = pl;

    /* Play the digital media item in the new playlist. */
    Player.controls.play();
">

Requirements

Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

MediaCollection Object

Playlist Object

Settings.mediaAccessRights

Settings.requestMediaAccessRights