CurrentPlaylistChange (evento) del objeto AxWindowsMediaPlayer
[La característica asociada a esta página, Reproductor multimedia de Windows SDK, es una característica heredada. Se ha reemplazado por MediaPlayer. MediaPlayer se ha optimizado para Windows 10 y Windows 11. Microsoft recomienda encarecidamente que el nuevo código use MediaPlayer en lugar de Reproductor multimedia de Windows SDK, siempre que sea posible. Microsoft sugiere que el código existente que usa las API heredadas se reescriba para usar las nuevas API si es posible.
El evento CurrentPlaylistChange se produce cuando cambia algo dentro de la lista de reproducción actual.
[C#]
private void player_CurrentPlaylistChange(
object sender,
_WMPOCXEvents_CurrentPlaylistChangeEvent e
)
[Visual Basic]
Private Sub player_CurrentPlaylistChange(
sender As Object,
e As _WMPOCXEvents_CurrentPlaylistChangeEvent
) Handles player.CurrentPlaylistChange
Datos del evento
El controlador asociado a este evento es de tipo AxWMPLib._WMPOCXEvents_CurrentPlaylistChangeEventHandler. Este controlador recibe un argumento de tipo AxWMPLib._WMPOCXEvents_CurrentPlaylistChangeEvent, que contiene la siguiente propiedad relacionada con este evento.
Propiedad | Descripción |
---|---|
cambiar | WMPLib.WMPPlaylistChangeEventTypeAn valor de enumeración que indica el tipo de cambio que se produjo en la lista de reproducción. |
Observaciones
Este evento no se produce cuando una lista de reproducción diferente se convierte en la lista de reproducción actual. Solo se produce cuando se produce un cambio en la lista de reproducción actual, como un elemento multimedia que se anexa a la lista de reproducción.
Ejemplos
En el ejemplo siguiente se muestran los nombres de todos los elementos multimedia de la lista de reproducción actual en respuesta al evento CurrentPlaylistChange. El objeto AxWMPLib.AxWindowsMediaPlayer se representa mediante la variable denominada player.
// Add a delegate for the CurrentPlaylistChange event.
player.CurrentPlaylistChange += new AxWMPLib._WMPOCXEvents_CurrentPlaylistChangeEventHandler(player_CurrentPlaylistChange);
private void player_CurrentPlaylistChange(object sender, AxWMPLib._WMPOCXEvents_CurrentPlaylistChangeEvent e)
{
switch(e.change)
{
// Only update the list for the move, delete, insert, and append event types.
case WMPLib.WMPPlaylistChangeEventType.wmplcMove: // Value = 3
case WMPLib.WMPPlaylistChangeEventType.wmplcDelete: // Value = 4
case WMPLib.WMPPlaylistChangeEventType.wmplcInsert: // Value = 5
case WMPLib.WMPPlaylistChangeEventType.wmplcAppend: // Value = 6
// Create a string array large enough to hold all of the media item names.
int count = player.currentPlaylist.count;
string[] mediaItems = new string[count];
// Clear any previous contents of the text box.
playlistItems.Clear();
// Loop through the playlist and store each media item name.
for (int i = 0; i < count; i++)
{
mediaItems[i] = player.currentPlaylist.get_Item(i).name;
}
// Display the media item names.
playlistItems.Lines = mediaItems;
break;
default:
break;
}
}
Public Sub player_CurrentPlaylistChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_CurrentPlaylistChangeEvent) Handles player.CurrentPlaylistChange
Select Case e.change
' Only update the list for the move, delete, insert, and append event types.
Case WMPLib.WMPPlaylistChangeEventType.wmplcMove ' Value = 3
Case WMPLib.WMPPlaylistChangeEventType.wmplcDelete ' Value = 4
Case WMPLib.WMPPlaylistChangeEventType.wmplcInsert ' Value = 5
Case WMPLib.WMPPlaylistChangeEventType.wmplcAppend ' Value = 6
' Create a string array large enough to hold all of the media item names.
Dim count As Integer = player.currentPlaylist.count
Dim mediaItems(count) As String
' Clear any previous contents of the text box.
playlistItems.Clear()
' Loop through the playlist and store each media item name.
For i As Integer = 0 To (count - 1)
mediaItems(i) = player.currentPlaylist.Item(i).name
Next i
' Display the media item names.
playlistItems.Lines = mediaItems
End Select
End Sub
Requisitos
Requisito | Value |
---|---|
Versión |
Reproductor multimedia de Windows serie 9 o posterior |
Espacio de nombres |
AxWMPLib |
Ensamblado |
|
Consulte también
Comentarios
https://aka.ms/ContentUserFeedback.
Próximamente: A lo largo de 2024 iremos eliminando gradualmente GitHub Issues como mecanismo de comentarios sobre el contenido y lo sustituiremos por un nuevo sistema de comentarios. Para más información, vea:Enviar y ver comentarios de