Compartilhar via


Network.bandWidth

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The bandWidth property retrieves the current bandwidth of the clip.

Syntax

player.network.bandWidth

Possible Values

This property is a read-only Number (long).

Remarks

This property returns zero if the Player.URL property is not set. This property is only valid for streaming media.

Examples

The following Microsoft JScript example uses Network.bandWidth to display the current media bandwidth. The information is displayed in an HTML DIV created with ID = "BW". The Player object was created with ID = "Player".

<!-- Create an event handler for play state.-->
<SCRIPT FOR = Player EVENT = PlayStateChange()>

   switch (Player.playState){

      case 3:

         if (Player.network.bandwidth != 0){
  
            BW.innerHTML = "Current Bandwidth: " + Player.network.bandWidth;
            BW.innerHTML += " K bits/second";
         }

         else
            BW.innerHTML = "Bandwidth is only available for streaming media.";

            break;

      default:
}
</SCRIPT>

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

Network Object

Player.URL