Share via


Propriedade AxWindowsMediaPlayer.currentMedia

[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.]

A propriedade currentMedia obtém ou define a interface IWMPMedia que corresponde ao item de mídia atual.

Sintaxe

public IWMPMedia currentMedia {get; set;}

Public Property currentMedia As IWMPMedia

Valor da propriedade

A interface WMPLib.IWMPMedia que fornece acesso ao item de mídia atual.

Comentários

Se o AxWindowsMediaPlayer.settings. autoStart property is true, playback begins automatically whenever you set currentMedia.

Você pode recuperar uma interface IWMPMedia para um determinado item de mídia por meio da propriedade IWMPPlaylist.Item (o método IWMPPlaylist.get_Item em C#). Para carregar um item de mídia usando um nome de arquivo, defina a propriedade URL ou use newMedia.

Exemplos

O exemplo a seguir recupera o primeiro item de mídia na biblioteca e usa a propriedade currentMedia para definir o item de mídia recuperado como o item de mídia atual e exibir seu nome. O objeto AxWMPLib.AxWindowsMediaPlayer é representado pela variável chamada player.

// Get an interface to the first media item in the library. 
WMPLib.IWMPMedia3 firstMedia = (WMPLib.IWMPMedia3)player.mediaCollection.getAll().get_Item(0);

// Make the retrieved media item the current media item.
player.currentMedia = firstMedia;

// Display the name of the current media item.
currentMediaLabel.Text = ("Found first media item. Name = " + player.currentMedia.name);

' Get an interface to the first media item in the library. 
Dim firstMedia As WMPLib.IWMPMedia3 = player.mediaCollection.getAll().Item(0)

' Make the retrieved media item the current media item.
player.currentMedia = firstMedia

' Display the name of the current media item.
currentMediaLabel.Text = ("Found first media item. Name = " + player.currentMedia.name)

Requisitos

Requisito Valor
Versão
série Reprodutor Multimídia do Windows 9 ou posterior
Namespace
AxWMPLib
Assembly
AxInterop.WMPLib.dll (AxInterop.WMPLib.dll.dll)

Confira também

Objeto AxWindowsMediaPlayer (VB e C#)

AxWindowsMediaPlayer.newMedia (VB e C#)

AxWindowsMediaPlayer.URL (VB e C#)

Interface IWMPMedia (VB e C#)

IWMPPlaylist.Item (VB e C#)

IWMPSettings.autoStart (VB e C#)