Propiedad IWMPNetwork::bufferingProgress

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

La propiedad bufferingProgress obtiene el porcentaje de almacenamiento en búfer completado.

Sintaxis

public System.Int32 bufferingProgress {get; set;}

Public ReadOnly Property bufferingProgress As System.Int32

Valor de propiedad

System.Int32 que es el progreso de almacenamiento en búfer expresado como un porcentaje.

Observaciones

Cada vez que se detiene y se reinicia la reproducción, esta propiedad se restablece a cero. No se restablece si la reproducción está en pausa.

El almacenamiento en búfer solo se aplica al contenido de streaming. Esta propiedad obtiene información válida solo durante el tiempo de ejecución cuando la dirección URL de reproducción se establece mediante la propiedad AxWindowsMediaPlayer.URL .

Use el AxWindowsMediaPlayer._WMPOCXEvents_BufferingEvent para determinar cuándo se inicia o detiene el almacenamiento en búfer.

Ejemplos

En el ejemplo siguiente se usa bufferingProgress para mostrar el porcentaje de almacenamiento en búfer completado en una etiqueta, en respuesta al evento de almacenamiento en búfer. En el ejemplo se usa un temporizador con un intervalo de 1 segundo para actualizar la pantalla. El objeto AxWMPLib.AxWindowsMediaPlayer se representa mediante la variable denominada player.

// Add a delegate for the Buffering event.
player.Buffering += new AxWMPLib._WMPOCXEvents_BufferingEventHandler(player_Buffering);

// Create an event handler for the Buffering event.
private void player_Buffering(object sender, AxWMPLib._WMPOCXEvents_BufferingEvent e)
{
    // Determine whether buffering has started or stopped.
    if (e.start == true)
    {
        // Set the timer interval at one second (1000 miliseconds).
        timer.Interval = 1000;
        
        // Start the timer.
        timer.Start();
    }
    else
    {
        // Buffering is complete. Stop the timer.
        timer.Stop();
    }
}

// Update the buffering progress in a timer event handler.
private void UpdateBufferingProgress(object sender, EventArgs e)
{
    bufferingProgressLabel.Text = ("Buffering progress: " + player.network.bufferingProgress + " percent complete");
}

' Create an event handler for the Buffering event.
Public Sub player_Buffering(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_BufferingEvent) Handles player.Buffering

    ' Test whether packets may be arriving.
    Select Case e.newState

    ' If WMPPlayState is Stopped, Paused, ScanForward, ScanReverse, Waiting, MediaEnded
    ' or Transitioning then stop the timer. 
        Case 1
        Case 2
        Case 4
        Case 5
        Case 7
        Case 8
        Case 9
            timer.Stop()

        ' If WMPPlayState is Playing or Buffering then set the timer interval and start the timer.
        Case Else
            timer.Interval = 1000
            timer.Start()

    End Select

End Sub

' Update the buffering progress in a timer event handler.
Public Sub UpdateBufferingProgress(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer.Tick

    bufferingProgressLabel.Text = ("Buffering progress: " + player.network.bufferingProgress + " percent complete")

End Sub

Requisitos

Requisito Value
Versión
Reproductor multimedia de Windows serie 9 o posterior
Espacio de nombres
WMPLib
Ensamblado
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

Consulte también

AxWindowsMediaPlayer.URL (VB y C#)

Evento AxWindowsMediaPlayer.Buffering (VB y C#)

Interfaz IWMPNetwork (VB y C#)