Compartilhar via


Método MediaCollection.getByGenre

[O recurso associado a esta página, Reprodutor Multimídia do Windows SDK, é um recurso herdado. Foi substituído pelo MediaPlayer. O MediaPlayer foi otimizado para Windows 10 e Windows 11. A Microsoft recomenda fortemente que o novo código use o MediaPlayer em vez de Reprodutor Multimídia do Windows SDK, quando possível. A Microsoft sugere que o código existente que usa as APIs herdadas seja reescrito para usar as novas APIs, se possível.]

O método getByGenre recupera uma playlist dos itens de mídia com o gênero especificado.

Sintaxe

retVal = MediaCollection.getByGenre(
  genre
)

Parâmetros

gênero [in]

Cadeia de caracteres que contém o nome do gênero.

Retornar valor

Esse método retorna um objeto Playlist .

Comentários

Para usar esse método, o acesso de leitura à biblioteca é necessário. Para obter mais informações, consulte Acesso à biblioteca.

Exemplos

O exemplo de JScript a seguir usa MediaCollection. getByGenre para recuperar uma playlist de itens de mídia. A playlist contém itens com o gênero especificado pelo usuário em um elemento de entrada HTML TEXT chamado GetGenre. O objeto Player foi criado com 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();
">

Requisitos

Requisito Valor
Versão
Reprodutor Multimídia do Windows versão 7.0 ou posterior.
DLL
Wmp.dll

Confira também

Objeto MediaCollection

Objeto Playlist

Settings.mediaAccessRights

Settings.requestMediaAccessRights