Share via


Windows Media Player 11 SDK IWMPNetwork.bitRate (VB and C#) 

Windows Media Player SDK banner art

Previous Next

IWMPNetwork.bitRate (VB and C#)

The bitRate property gets the current bit rate being received.

  

Property Value

A System.Int32 that is the bit rate.

Remarks

The value of this property is a combination of the bit rates of both video and audio streams.

Example Code

The following example uses bitRate to display the current media bit rate. The information is displayed in a label in response to the PlayStateChange Event. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

  
' Create an event handler for the PlayStateChange event.
Public Sub player_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles player.PlayStateChange

    ' Display the bitRate when the player is playing. 
    Select Case e.newState

        Case 3 ' Play State = WMPLib.WMPPlayState.wmppsPlaying = 3

            If (player.network.bitRate <> 0) Then

                bitRateLabel.Text = "Current Bit Rate: " + player.network.bitRate + " K bits/second"

            End If

    End Select

End Sub

FakePre-f2d55aae9a3d4c4c9b18d28feb5802ac-01a73615684349369e7363ece6ff46cf

// Add a delegate for the PlayStateChange event.
player.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(player_PlayStateChange);

// Create an event handler for the PlayStateChange event.
private void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
    // Display the bitRate when the player is playing. 
    switch (e.newState)
    {
        case 3:  // Play State = WMPLib.WMPPlayState.wmppsPlaying = 3
            if (player.network.bitRate != 0)
            {
                bitRateLabel.Text = "Current Bit Rate: " + player.network.bitRate + " K bits/second";
            }
            break;

        default:
            break;
    }
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)

See Also

Previous Next