Proprietà IWMPNetwork::bufferingProgress
[La funzionalità associata a questa pagina, Lettore multimediale Windows SDK, è una funzionalità legacy. È stato sostituito da MediaPlayer. MediaPlayer è stato ottimizzato per Windows 10 e Windows 11. Microsoft consiglia vivamente che il nuovo codice usi MediaPlayer invece di Lettore multimediale Windows SDK, quando possibile. Microsoft suggerisce che il codice esistente che usa le API legacy venga riscritto per usare le nuove API, se possibile.
La proprietà bufferingProgress ottiene la percentuale di buffering completata.
Sintassi
public System.Int32 bufferingProgress {get; set;}
Public ReadOnly Property bufferingProgress As System.Int32
Valore proprietà
Oggetto System.Int32 che rappresenta lo stato di avanzamento del buffer espresso come percentuale.
Commenti
Ogni volta che la riproduzione viene arrestata e riavviata, questa proprietà viene reimpostata su zero. Non viene reimpostato se la riproduzione è sospesa.
Il buffering si applica solo al contenuto di streaming. Questa proprietà ottiene informazioni valide solo durante l'esecuzione quando l'URL per la riproduzione viene impostato usando la proprietà AxWindowsMediaPlayer.URL .
Usare il AxWindowsMediaPlayer._WMPOCXEvents_BufferingEvent per determinare quando il buffer viene avviato o arrestato.
Esempio
Nell'esempio seguente viene usato bufferingProgress per visualizzare la percentuale di buffering completata in un'etichetta, in risposta all'evento di buffering. Nell'esempio viene utilizzato un timer con un intervallo di 1 secondo per aggiornare la visualizzazione. L'oggetto AxWMPLib.AxWindowsMediaPlayer è rappresentato dalla variabile denominata 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
Requisiti
Requisito | Valore |
---|---|
Versione |
Lettore multimediale Windows serie 9 o successive |
Spazio dei nomi |
WMPLib |
Assembly |
|
Vedi anche
Commenti e suggerimenti
https://aka.ms/ContentUserFeedback.
Presto disponibile: Nel corso del 2024 verranno gradualmente disattivati i problemi di GitHub come meccanismo di feedback per il contenuto e ciò verrà sostituito con un nuovo sistema di feedback. Per altre informazioni, vedereInvia e visualizza il feedback per