Share via


Network.downloadProgress

[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à downloadProgress recupera la percentuale di download completata.

Sintassi

giocatore. rete. downloadProgress

Valori possibili

Questa proprietà è un valore Number di sola lettura (long).

Commenti

Quando il controllo Lettore multimediale Windows è connesso a un file multimediale che può essere riprodotto e scaricato contemporaneamente, la proprietà downloadProgress restituisce la percentuale del file totale scaricato. Questa funzionalità è attualmente supportata solo nei server Web. I formati di file seguenti possono essere scaricati e riprodotti contemporaneamente:

  • Advanced Systems Format (ASF)
  • Windows Media Audio (WMA)
  • Windows Media Video (WMV)
  • MP3
  • MPEG
  • WAV
  • Alcuni file AVI

Usare il lettore. Evento di buffering per determinare quando inizia e termina il download.

Esempio

L'esempio JScript seguente usa Network. downloadProgress per visualizzare la percentuale di download completato. Le informazioni vengono visualizzate in un DIV HTML creato con ID = "DP". Nell'esempio viene utilizzato un timer con un intervallo di 1 secondo per aggiornare la visualizzazione. L'oggetto Player è stato creato con ID = "Player".

<!-- Create an event handler for buffering. -->
<SCRIPT FOR = Player EVENT = buffering(Start)>
   var idI; // Variable for the interval id.
   
   // Test whether downloading has started or stopped.
   if (true == Start){ 
      // Start the timer. Call the function to update the display.
      idI = window.setInterval("UpdateDP()", 1000);
   }
   else{
      // Downloading is complete. Stop the timer.
      window.clearInterval(idI);
   }
</SCRIPT>

<!-- Put the function to update the display in a separate code block. -->
<SCRIPT>
function UpdateDP(){
   DP.innerHTML = "";
   DP.innerHTML = "Download progress: " + Player.network.downloadProgress;
   DP.innerHTML += " percent complete";
}
</SCRIPT>

Requisiti

Requisito Valore
Versione
Lettore multimediale Windows versione 7.0 o successiva.
DLL
Wmp.dll

Vedi anche

Oggetto Network

Evento Player.Buffering