Propiedad IWMPNetwork::d ownloadProgress
La propiedad downloadProgress obtiene el porcentaje de descarga completada.
Sintaxis
public System.Int32 downloadProgress {get; set;}
Public ReadOnly Property downloadProgress As System.Int32
Valor de propiedad
System.Int32 que es el progreso de descarga expresado como un porcentaje.
Observaciones
Cuando el control Reproductor multimedia de Windows está conectado a un archivo multimedia digital que se puede reproducir y descargar al mismo tiempo, la propiedad downloadProgress obtiene el porcentaje del archivo total que se ha descargado. Esta característica solo se admite actualmente para archivos multimedia digitales descargados de servidores web. Se puede descargar y reproducir simultáneamente un archivo de cualquiera de los formatos siguientes:
- Formato ASF
- Audio de Windows Media (WMA)
- Vídeo de Windows Media (WMV)
- MP3
- MPEG
- WAV
Además, algunos archivos AVI se pueden descargar y reproducir simultáneamente.
Use el AxWindowsMediaPlayer._WMPOCXEvents_BufferingEvent para determinar cuándo se inicia o detiene el almacenamiento en búfer.
Ejemplos
En el ejemplo de código siguiente se usa downloadProgress para mostrar el porcentaje de descarga completada. La información se muestra 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 download progress in a timer event handler.
private void UpdateDownloadProgress(object sender, EventArgs e)
{
downloadProgressLabel.Text = ("Download progress: " + player.network.downloadProgress + " 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 download progress in a timer event handler.
Public Sub UpdateDownloadProgress(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer.Tick
downloadProgressLabel.Text = ("Download progress: " + player.network.downloadProgress + " percent complete")
End Sub
Requisitos
Requisito | Value |
---|---|
Versión |
Reproductor multimedia de Windows serie 9 o posterior |
Espacio de nombres |
WMPLib |
Ensamblado |
|